service

package
v0.0.0-...-c97221a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: GPL-3.0 Imports: 33 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientMap

func NewClientMap(sessionMap SessionMap) *clientMap

NewClientMap creates a new instance of client map.

func ParseJSONOptions

func ParseJSONOptions(request *json.RawMessage) (service.Options, error)

ParseJSONOptions function fills in OpenVPN options from JSON request, falling back to configured options for missing values

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager represents entrypoint for Openvpn service with top level components

func NewManager

func NewManager(nodeOptions node.Options,
	serviceOptions Options,
	country string,
	ipResolver ip.Resolver,
	sessionMap SessionMap,
	natService nat.NATService,
	portPool port.ServicePortSupplier,
	bus eventbus.EventBus,
	trafficFirewall firewall.IncomingTrafficFirewall,
) *Manager

NewManager creates new instance of Openvpn service

func (*Manager) ProvideConfig

func (m *Manager) ProvideConfig(sessionID string, sessionConfig json.RawMessage, conn *net.UDPConn) (*service.ConfigParams, error)

ProvideConfig takes session creation config from end consumer and provides the service configuration to the end consumer

func (*Manager) Serve

func (m *Manager) Serve(instance *service.Instance) (err error)

Serve starts service - does block

func (*Manager) Stop

func (m *Manager) Stop() error

Stop stops service

type Options

type Options struct {
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
	Subnet   string `json:"subnet"`
	Netmask  string `json:"netmask"`
}

Options describes options which are required to start Openvpn service

func GetOptions

func GetOptions() Options

GetOptions returns effective OpenVPN service options from application configuration.

type ProposalFactory

type ProposalFactory func(currentLocation market.Location) market.ServiceProposal

ProposalFactory prepares service proposal during runtime

type ServerConfig

type ServerConfig struct {
	*config.GenericConfig
}

ServerConfig defines openvpn in server mode configuration structure

func NewServerConfig

func NewServerConfig(
	runtimeDir string,
	scriptDir string,
	network, netmask string,
	secPrimitives *tls.Primitives,
	bindAddress string,
	port int,
	protocol string,
) *ServerConfig

NewServerConfig creates server configuration structure from given basic parameters

func (*ServerConfig) SetProtocol

func (c *ServerConfig) SetProtocol(protocol string)

SetProtocol adds protocol option (tcp or udp)

func (*ServerConfig) SetServerMode

func (c *ServerConfig) SetServerMode(port int, network, netmask string)

SetServerMode sets a set of options for openvpn to act as server

func (*ServerConfig) SetTLSServer

func (c *ServerConfig) SetTLSServer()

SetTLSServer add tls-server option to config, also sets dh to none

type SessionMap

type SessionMap interface {
	Find(session.ID) (*service.Session, bool)
}

SessionMap defines map of current sessions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL