mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Setting the ip from the network interface to Addresses
This commit is contained in:
@@ -220,6 +220,7 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error finding ip address from interface %q: %v", a.config.Interfaces.HTTP, err)
|
||||
}
|
||||
a.config.Addresses.HTTP = ip.String()
|
||||
httpAddr = fmt.Sprintf("%s:%d", ip.String(), a.config.Ports.HTTP)
|
||||
} else if a.config.AdvertiseAddrs.HTTP != "" {
|
||||
addr, err := net.ResolveTCPAddr("tcp", a.config.AdvertiseAddrs.HTTP)
|
||||
|
||||
@@ -31,8 +31,6 @@ func ipOfDevice(name string) (net.IP, error) {
|
||||
var ip net.IP
|
||||
switch v := (addr).(type) {
|
||||
case *net.IPNet:
|
||||
continue
|
||||
case *net.IPAddr:
|
||||
ip = v.IP
|
||||
if ip.To4() != nil {
|
||||
ipv4Addrs = append(ipv4Addrs, ip)
|
||||
@@ -42,6 +40,8 @@ func ipOfDevice(name string) (net.IP, error) {
|
||||
ipv6Addrs = append(ipv6Addrs, ip)
|
||||
continue
|
||||
}
|
||||
case *net.IPAddr:
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(ipv4Addrs) > 0 {
|
||||
|
||||
Reference in New Issue
Block a user