peer autostart vpn on startup
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
1e9e515e65
commit
fb314539eb
2 changed files with 4 additions and 7 deletions
|
@ -41,6 +41,7 @@ const (
|
||||||
// Peer is the non-node peer
|
// Peer is the non-node peer
|
||||||
type Peer struct {
|
type Peer struct {
|
||||||
cfg *heimdall.PeerConfig
|
cfg *heimdall.PeerConfig
|
||||||
|
currentVersion string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPeer returns a new peer
|
// NewPeer returns a new peer
|
||||||
|
|
|
@ -72,15 +72,11 @@ func (p *Peer) sync(ctx context.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
e, err := heimdall.HashConfig(wireguardConfigPath)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// if config has not change skip update
|
// if config has not change skip update
|
||||||
if h == e {
|
if h == p.currentVersion {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
p.currentVersion = h
|
||||||
|
|
||||||
logrus.Debugf("updating peer config to version %s", h)
|
logrus.Debugf("updating peer config to version %s", h)
|
||||||
// update wireguard config
|
// update wireguard config
|
||||||
|
|
Loading…
Reference in a new issue