peer autostart vpn on startup

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2019-10-08 18:17:17 -04:00
parent 1e9e515e65
commit fb314539eb
No known key found for this signature in database
GPG Key ID: A519480096146526
2 changed files with 4 additions and 7 deletions

View File

@ -40,7 +40,8 @@ const (
// Peer is the non-node peer
type Peer struct {
cfg *heimdall.PeerConfig
cfg *heimdall.PeerConfig
currentVersion string
}
// NewPeer returns a new peer

View File

@ -72,15 +72,11 @@ func (p *Peer) sync(ctx context.Context) error {
return err
}
e, err := heimdall.HashConfig(wireguardConfigPath)
if err != nil {
return err
}
// if config has not change skip update
if h == e {
if h == p.currentVersion {
return nil
}
p.currentVersion = h
logrus.Debugf("updating peer config to version %s", h)
// update wireguard config