don't use string respresentations unnecessarily
This commit is contained in:
parent
e7fb9dc5ce
commit
e7da49c1a8
13
add.go
13
add.go
@ -96,13 +96,10 @@ func Add() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func PrintPeerCfg(peer PeerConfig, conf *DsnetConfig) {
|
func PrintPeerCfg(peer PeerConfig, conf *DsnetConfig) {
|
||||||
allowedIPsStr := make([]string, len(conf.Networks)+2)
|
allowedIPs := make([]JSONIPNet, len(conf.Networks)+2)
|
||||||
allowedIPsStr[0] = conf.Network.String()
|
allowedIPs[0] = conf.Network
|
||||||
allowedIPsStr[1] = conf.Network6.String()
|
allowedIPs[1] = conf.Network6
|
||||||
|
allowedIPs = append(allowedIPs, conf.Networks...)
|
||||||
for i, net := range conf.Networks {
|
|
||||||
allowedIPsStr[i+2] = net.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
var peerConf string
|
var peerConf string
|
||||||
|
|
||||||
@ -124,7 +121,7 @@ func PrintPeerCfg(peer PeerConfig, conf *DsnetConfig) {
|
|||||||
"Peer": peer,
|
"Peer": peer,
|
||||||
"DsnetConfig": conf,
|
"DsnetConfig": conf,
|
||||||
"Keepalive": time.Duration(KEEPALIVE).Seconds(),
|
"Keepalive": time.Duration(KEEPALIVE).Seconds(),
|
||||||
"AllowedIPs": allowedIPsStr,
|
"AllowedIPs": allowedIPs,
|
||||||
"Cidrmask": cidrmask,
|
"Cidrmask": cidrmask,
|
||||||
})
|
})
|
||||||
check(err)
|
check(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user