mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-15 06:05:27 +08:00
46 lines
909 B
Go
46 lines
909 B
Go
package models
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
)
|
|
|
|
const (
|
|
NmProxyPort = 51722
|
|
DefaultCIDR = "127.0.0.1/8"
|
|
)
|
|
|
|
// ConnConfig is a peer Connection configuration
|
|
type ConnConfig struct {
|
|
|
|
// Key is a public key of a remote peer
|
|
Key wgtypes.Key
|
|
IsExtClient bool
|
|
IsRelayed bool
|
|
RelayedEndpoint *net.UDPAddr
|
|
IsAttachedExtClient bool
|
|
PeerConf *wgtypes.PeerConfig
|
|
StopConn context.CancelFunc
|
|
RemoteConn *net.UDPAddr
|
|
LocalConn net.Conn
|
|
}
|
|
|
|
type RemotePeer struct {
|
|
PeerKey string
|
|
Interface string
|
|
Endpoint *net.UDPAddr
|
|
IsExtClient bool
|
|
IsAttachedExtClient bool
|
|
}
|
|
|
|
type ExtClientPeer struct {
|
|
CancelFunc context.CancelFunc
|
|
CommChan chan *net.UDPAddr
|
|
}
|
|
|
|
type WgIfaceConf struct {
|
|
Iface *wgtypes.Device
|
|
PeerMap map[string]*ConnConfig
|
|
}
|