tiny refactor: just move around some code
The router name derivation uses the result of createOverlay, so move it closer to that.
This commit is contained in:
1 parent
9f79e5be54
commit
9b4a5d1cb4
1 file changed
+15
-16
+15
-16
@@ -133,6 +133,21 @@ func main() {
|
|||||||
overlay, bridge := createOverlay(datapathName, ifaceName, config.Port, bufSzMB)
|
overlay, bridge := createOverlay(datapathName, ifaceName, config.Port, bufSzMB)
|
||||||
networkConfig.Bridge = bridge
|
networkConfig.Bridge = bridge
|
||||||
|
|
||||||
|
if routerName == "" {
|
||||||
|
iface := bridge.Interface()
|
||||||
|
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)
|
||||||
|
|
||||||
|
if nickName == "" {
|
||||||
|
nickName, err = os.Hostname()
|
||||||
|
checkFatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
if password == "" {
|
if password == "" {
|
||||||
password = os.Getenv("WEAVE_PASSWORD")
|
password = os.Getenv("WEAVE_PASSWORD")
|
||||||
}
|
}
|
||||||
@@ -143,22 +158,6 @@ func main() {
|
|||||||
Log.Println("Communication between peers via untrusted networks is encrypted.")
|
Log.Println("Communication between peers via untrusted networks is encrypted.")
|
||||||
}
|
}
|
||||||
|
|
||||||
if routerName == "" {
|
|
||||||
iface := networkConfig.Bridge.Interface()
|
|
||||||
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)
|
|
||||||
|
|
||||||
if nickName == "" {
|
|
||||||
nickName, err = os.Hostname()
|
|
||||||
checkFatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if prof != "" {
|
if prof != "" {
|
||||||
p := *profile.CPUProfile
|
p := *profile.CPUProfile
|
||||||
p.ProfilePath = prof
|
p.ProfilePath = prof
|
||||||
|
|||||||
Reference in new issue
Block a user