From fb314539eb8907bc5c4ab2e8c15adcada1127bec Mon Sep 17 00:00:00 2001 From: Evan Hazlett Date: Tue, 8 Oct 2019 18:17:17 -0400 Subject: [PATCH] peer autostart vpn on startup Signed-off-by: Evan Hazlett --- peer/peer.go | 3 ++- peer/sync.go | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/peer/peer.go b/peer/peer.go index 9258f83..0d4bca7 100644 --- a/peer/peer.go +++ b/peer/peer.go @@ -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 diff --git a/peer/sync.go b/peer/sync.go index 9504b52..bccfee3 100644 --- a/peer/sync.go +++ b/peer/sync.go @@ -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