mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-23 08:33:45 +01:00
e6e9f0322f
Before this change, NetBird Agent wasn't handling peer interface configuration changes dynamically. Also, remote peer configuration changes have not been applied (e.g. AllowedIPs changed). Not a very common cause, but still it should be handled. Now, Agent reacts to PeerConfig changes sent from the management service and restarts remote connections if AllowedIps have been changed.
35 lines
608 B
Go
35 lines
608 B
Go
package proxy
|
|
|
|
import (
|
|
"github.com/netbirdio/netbird/iface"
|
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
"io"
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
const DefaultWgKeepAlive = 25 * time.Second
|
|
|
|
type Type string
|
|
|
|
const (
|
|
TypeNoProxy Type = "NoProxy"
|
|
TypeWireguard Type = "Wireguard"
|
|
TypeDummy Type = "Dummy"
|
|
)
|
|
|
|
type Config struct {
|
|
WgListenAddr string
|
|
RemoteKey string
|
|
WgInterface *iface.WGIface
|
|
AllowedIps string
|
|
PreSharedKey *wgtypes.Key
|
|
}
|
|
|
|
type Proxy interface {
|
|
io.Closer
|
|
// Start creates a local remoteConn and starts proxying data from/to remoteConn
|
|
Start(remoteConn net.Conn) error
|
|
Type() Type
|
|
}
|