@@ -72,8 +72,7 @@ func GetIfaceAddr(name string) (net.Addr, []net.Addr, error) {
7272 if err != nil {
7373 return nil , nil , err
7474 }
75- var addrs4 []net.Addr
76- var addrs6 []net.Addr
75+ var addrs4 , addrs6 []net.Addr
7776 for _ , addr := range addrs {
7877 ip := (addr .(* net.IPNet )).IP
7978 if ip4 := ip .To4 (); ip4 != nil {
@@ -84,7 +83,7 @@ func GetIfaceAddr(name string) (net.Addr, []net.Addr, error) {
8483 }
8584 switch {
8685 case len (addrs4 ) == 0 :
87- return nil , nil , fmt .Errorf ("Interface %v has no IPv4 addresses" , name )
86+ return nil , nil , fmt .Errorf ("interface %v has no IPv4 addresses" , name )
8887 case len (addrs4 ) > 1 :
8988 fmt .Printf ("Interface %v has more than 1 IPv4 address. Defaulting to using %v\n " ,
9089 name , (addrs4 [0 ].(* net.IPNet )).IP )
@@ -173,9 +172,9 @@ func ParseAlias(val string) (string, string, error) {
173172 if val == "" {
174173 return "" , "" , errors .New ("empty string specified for alias" )
175174 }
176- arr := strings .Split (val , ":" )
175+ arr := strings .SplitN (val , ":" , 3 )
177176 if len (arr ) > 2 {
178- return "" , "" , fmt . Errorf ("bad format for alias: %s" , val )
177+ return "" , "" , errors . New ("bad format for alias: " + val )
179178 }
180179 if len (arr ) == 1 {
181180 return val , val , nil
0 commit comments