Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tiny refactor: just move around some code
The router name derivation uses the result of createOverlay, so move it closer to that.
- Loading branch information
Showing
1 changed file
with
11 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,24 +133,13 @@ func main() { | |
overlay, bridge := createOverlay(datapathName, ifaceName, config.Port, bufSzMB) | ||
networkConfig.Bridge = bridge | ||
|
||
if password == "" { | ||
password = os.Getenv("WEAVE_PASSWORD") | ||
} | ||
if password == "" { | ||
Log.Println("Communication between peers is unencrypted.") | ||
} else { | ||
config.Password = []byte(password) | ||
Log.Println("Communication between peers via untrusted networks is encrypted.") | ||
} | ||
|
||
if routerName == "" { | ||
iface := networkConfig.Bridge.Interface() | ||
iface := bridge.Interface() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rade
Author
Member
|
||
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) | ||
|
||
|
@@ -159,6 +148,16 @@ func main() { | |
checkFatal(err) | ||
} | ||
|
||
if password == "" { | ||
password = os.Getenv("WEAVE_PASSWORD") | ||
} | ||
if password == "" { | ||
Log.Println("Communication between peers is unencrypted.") | ||
} else { | ||
config.Password = []byte(password) | ||
Log.Println("Communication between peers via untrusted networks is encrypted.") | ||
} | ||
|
||
if prof != "" { | ||
p := *profile.CPUProfile | ||
p.ProfilePath = prof | ||
|
Does it make sense to move the
networkConfig.Bridge = bridge
statement to be immediately after theif routerName = "" { ... }
block now? Create the overlay (and bridge), check the bridge interface, if all is good then assign it...