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:
Matthias Radestock committed 2016-01-13 13:52:09 +00:00
1 parent 9f79e5be54
commit 9b4a5d1cb4
1 file changed
+15 -16
+15 -16
View File
@@ -133,6 +133,21 @@ func main() {
overlay, bridge := createOverlay(datapathName, ifaceName, config.Port, bufSzMB)
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 == "" {
password = os.Getenv("WEAVE_PASSWORD")
}
@@ -143,22 +158,6 @@ func main() {
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 != "" {
p := *profile.CPUProfile
p.ProfilePath = prof