func peerName(routerName string, iface *net.Interface) mesh.PeerName { if routerName == "" { if iface == nil { Log.Fatal("Either an interface must be specified with --datapath or --iface, or a name with --name") } routerName = iface.HardwareAddr.String() } name, err := mesh.PeerNameFromUserInput(routerName) checkFatal(err) return name }
func parsePeerNames(s string) ([]mesh.PeerName, error) { peerNames := []mesh.PeerName{} if s == "" { return peerNames, nil } for _, peerNameStr := range strings.Split(s, ",") { peerName, err := mesh.PeerNameFromUserInput(peerNameStr) if err != nil { return nil, fmt.Errorf("error parsing peer names: %s", err) } peerNames = append(peerNames, peerName) } return peerNames, nil }