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

@ -41,6 +41,7 @@ const (
// Peer is the non-node peer
type Peer struct {
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