use keepalive const in template
This commit is contained in:
parent
75549f2ab7
commit
5f735112f2
4
add.go
4
add.go
@ -3,6 +3,7 @@ package dsnet
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
"text/template"
|
"text/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -59,13 +60,14 @@ PresharedKey={{ .Peer.PresharedKey.Key }}
|
|||||||
Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}
|
Endpoint={{ .DsnetConfig.ExternalIP }}:{{ .DsnetConfig.ListenPort }}
|
||||||
#AllowedIPs=0.0.0.0/0
|
#AllowedIPs=0.0.0.0/0
|
||||||
AllowedIPs={{ .DsnetConfig.Network }}
|
AllowedIPs={{ .DsnetConfig.Network }}
|
||||||
PersistentKeepalive=21
|
PersistentKeepalive={{ .Keepalive }}
|
||||||
`
|
`
|
||||||
|
|
||||||
t := template.Must(template.New("peerConf").Parse(peerConf))
|
t := template.Must(template.New("peerConf").Parse(peerConf))
|
||||||
err := t.Execute(os.Stdout, map[string]interface{}{
|
err := t.Execute(os.Stdout, map[string]interface{}{
|
||||||
"Peer": peer,
|
"Peer": peer,
|
||||||
"DsnetConfig": conf,
|
"DsnetConfig": conf,
|
||||||
|
"Keepalive": time.Duration(KEEPALIVE).Seconds(),
|
||||||
})
|
})
|
||||||
check(err)
|
check(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user