Documentation
¶
Index ¶
Constants ¶
View Source
const ServiceType = "wireguard"
ServiceType indicates "wireguard" service type
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConnectionEndpoint ¶
type ConnectionEndpoint interface { StartConsumerMode(config wgcfg.DeviceConfig) error ReconfigureConsumerMode(config wgcfg.DeviceConfig) error StartProviderMode(publicIP string, config wgcfg.DeviceConfig) error PeerStats() (wgcfg.Stats, error) Config() (ServiceConfig, error) InterfaceName() string Stop() error }
ConnectionEndpoint represents Wireguard network instance, it provide information required for establishing connection between service provider and consumer.
type ConsumerConfig ¶
type ConsumerConfig struct { PublicKey string `json:"PublicKey"` // IP is needed when provider is behind NAT. In such case provider parses this IP and tries to ping consumer. IP string `json:"IP,omitempty"` Ports []int `json:"Ports"` }
ConsumerConfig is used for sending the public key and IP from consumer to provider.
type EndpointFactory ¶
type EndpointFactory func() (ConnectionEndpoint, error)
EndpointFactory creates new connection endpoint.
type ServiceConfig ¶
type ServiceConfig struct { // LocalPort and RemotePort are needed for NAT hole punching only. LocalPort int `json:"-"` RemotePort int `json:"-"` Ports []int `json:"ports"` Provider struct { PublicKey string Endpoint net.UDPAddr } Consumer struct { IPAddress net.IPNet DNSIPs string } }
ServiceConfig represent a Wireguard service provider configuration that will be passed to the consumer for establishing a connection.
func (ServiceConfig) MarshalJSON ¶
func (s ServiceConfig) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface to provide human readable configuration.
func (*ServiceConfig) UnmarshalJSON ¶
func (s *ServiceConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface to receive human readable configuration.
Click to show internal directories.
Click to hide internal directories.