Mac address finding precondition checker fix.
mac address finding is based on `addrs`, and it could be empty, but the checker only exist when input param `ip` is empty.
@@ -39,13 +39,13 @@ func (l *LocalNode) Ready() error {
func NewLocalNode(ip string, identify string, identifyTypeString string) (node *LocalNode, err error) {
addrs, err := sockaddr.GetPrivateInterfaces()
+ if len(addrs) == 0 {
+ return node, errors.New("address not found")
+ }
if ip == "" {
if err != nil {
return node, err
}
- if len(addrs) == 0 {
- return node, errors.New("address not found")
- }
ipaddr := *sockaddr.ToIPAddr(addrs[0].SockAddr)
ip = ipaddr.NetIP().String()
}
