Documentation ¶
Overview ¶
Package wgtunnel sets up and configures Encore's WireGuard tunnel for authenticating against private environments.
Index ¶
- Variables
- func GenKey() (pub, priv wgtypes.Key, err error)
- func RegisterDevice(ctx context.Context, pubKey wgtypes.Key) (ip string, err error)
- func Run() error
- func Start(cc *ClientConfig, sc *ServerConfig) error
- func Status() (running bool, err error)
- func Stop() error
- type ClientConfig
- type ServerConfig
- type ServerPeer
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultServerConfig = &ServerConfig{ Peers: []ServerPeer{ { Endpoint: net.UDPAddr{ IP: net.ParseIP("159.65.210.129"), Port: 51820, }, PublicKey: mustParseKey("mQzDYCJufL+rNqbS1fBtxx3vxLX/4VaKKUDNS/yhQBs="), Subnets: []net.IPNet{ { IP: net.ParseIP("100.26.25.109"), Mask: net.IPv4Mask(255, 255, 255, 255), }, { IP: net.ParseIP("18.214.237.181"), Mask: net.IPv4Mask(255, 255, 255, 255), }, { IP: net.ParseIP("54.170.142.107"), Mask: net.IPv4Mask(255, 255, 255, 255), }, { IP: net.ParseIP("54.74.172.84"), Mask: net.IPv4Mask(255, 255, 255, 255), }, }, }, }, }
DefaultServerConfig is the well-known default configuration of Encore's API Gateway.
Functions ¶
func RegisterDevice ¶
RegisterDevice registers the public key with Encore and returns the allocated IP address for use with WireGuard.
func Start ¶
func Start(cc *ClientConfig, sc *ServerConfig) error
Start starts the WireGuard tunnel in the background.
Types ¶
type ClientConfig ¶
type ClientConfig struct { // Addr is our WireGuard address. Addr string // PrivKey is our private key. PrivKey wgtypes.Key }
ClientConfig is the configuration necessary to setup WireGuard.
type ServerConfig ¶
type ServerConfig struct {
Peers []ServerPeer
}
ServerConfig is the configuration to set up WireGuard peers.
type ServerPeer ¶
type ServerPeer struct { // Endpoint is the WireGuard endpoint for the server. Endpoint net.UDPAddr // PublicKey is the server's public key. PublicKey wgtypes.Key // Subnets are the network subnet that should be routed // through WireGuard. Subnets []net.IPNet }
ServerPeer is the required configuration to configure a WireGuard peer.
Click to show internal directories.
Click to hide internal directories.