Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = Options{ Subnet: net.IPNet{ IP: net.ParseIP("10.182.0.0").To4(), Mask: net.IPv4Mask(255, 255, 0, 0), }, }
DefaultOptions is a wireguard service configuration that will be used if no options provided.
Functions ¶
func ParseJSONOptions ¶
func ParseJSONOptions(request *json.RawMessage) (service.Options, error)
ParseJSONOptions function fills in Wireguard options from JSON request
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager represents an instance of Wireguard service
func NewManager ¶
func NewManager( ipResolver ip.Resolver, country string, natService nat.NATService, eventBus eventbus.EventBus, trafficFirewall firewall.IncomingTrafficFirewall, resourcesAllocator *resources.Allocator, wgClientFactory *endpoint.WgClientFactory, dnsProxy *dns.Proxy, ) *Manager
NewManager creates new instance of Wireguard service
func (*Manager) ProvideConfig ¶
func (m *Manager) ProvideConfig(sessionID string, sessionConfig json.RawMessage, remoteConn *net.UDPConn) (*service.ConfigParams, error)
ProvideConfig provides the config for consumer and handles new WireGuard connection.
type Options ¶
Options describes options which are required to start Wireguard service.
func GetOptions ¶
func GetOptions() Options
GetOptions returns effective Wireguard service options from application configuration.
func (Options) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface to provide human readable configuration.
func (*Options) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface to receive human readable configuration.