mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-06 03:31:00 +00:00
Add DynamoDB based collector
- Store compressed reports in dynamodb
Add SQS based control router.
- Uses a queue per probe and a queue per UI for control requests & responses.
Add Consul-based, horizontally-scalable, multi-tenant pipe router.
- Uses consul to coordinate each end of pipe connections replicas of a pipe service.
30 lines
549 B
Go
30 lines
549 B
Go
package network
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
)
|
|
|
|
// GetFirstAddressOf returns the first address of the supplied interface name.
|
|
func GetFirstAddressOf(name string) (string, error) {
|
|
inf, err := net.InterfaceByName(name)
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
addrs, err := inf.Addrs()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
if len(addrs) <= 0 {
|
|
return "", fmt.Errorf("No address found for %s", name)
|
|
}
|
|
|
|
switch v := addrs[0].(type) {
|
|
case *net.IPNet:
|
|
return v.IP.String(), nil
|
|
default:
|
|
return "", fmt.Errorf("No address found for %s", name)
|
|
}
|
|
}
|