regprocessor

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RegIDLen The length of the shared secret sent by the client in bytes.
	RegIDLen = 16

	// SecretLength gives the length of a secret (used for minimum registration body len)
	SecretLength = 32
)

Variables

View Source
var (
	ErrNoC2SBody = errors.New("no C2S body")

	ErrSharedSecret = errors.New("shared secret undefined or insufficient length")

	ErrZmqSocket   = errors.New("failed to create zmq socket")
	ErrZmqAuthFail = errors.New("failed to set up auth on zmq socket")

	ErrRegProcessFailed = errors.New("failed to process registration")

	ErrZmqFault = zmq.Errno(C.EINVAL)
)

Functions

This section is empty.

Types

type Ipnet added in v0.7.11

type Ipnet struct {
	*net.IPNet
}

func (*Ipnet) UnmarshalText added in v0.7.11

func (n *Ipnet) UnmarshalText(text []byte) error

UnmarshalText makes CIDR compatible with TOML decoding

type RegProcessor

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

RegProcessor provides an interface to publish registrations and helper functions to process registration requests

func NewRegProcessor

func NewRegProcessor(zmqBindAddr string, zmqPort uint16, privkey []byte, authVerbose bool, stationPublicKeys []string, metrics *metrics.Metrics, enforceSubnetOverrides bool, overrideSubnets []Subnet, exclusionsFromOverride []Subnet, prcntMinRegsToOverride float64, prcntPrefixRegsToOverride float64) (*RegProcessor, error)

NewRegProcessor initialize a new RegProcessor

func NewRegProcessorNoAuth

func NewRegProcessorNoAuth(zmqBindAddr string, zmqPort uint16, metrics *metrics.Metrics, enforceSubnetOverrides bool, overrideSubnets []Subnet, exclusionsFromOverride []Subnet, prcntMinRegsToOverride float64, prcntPrefixRegsToOverride float64) (*RegProcessor, error)

NewRegProcessorNoAuth creates a regprocessor without authentication to zmq address

func (*RegProcessor) AddTransport

func (p *RegProcessor) AddTransport(index pb.TransportType, t lib.Transport) error

AddTransport initializes a transport so that it can be tracked by the manager when clients register.

func (*RegProcessor) Close

func (p *RegProcessor) Close() error

Close cleans up the (ZMQ) servers running in the background supporting registration.

func (*RegProcessor) RegisterBidirectional

func (p *RegProcessor) RegisterBidirectional(c2sPayload *pb.C2SWrapper, regMethod pb.RegistrationSource, clientAddr []byte) (*pb.RegistrationResponse, error)

RegisterBidirectional process a bidirectional registration request, publish it to zmq, and returns a response

func (*RegProcessor) RegisterUnidirectional

func (p *RegProcessor) RegisterUnidirectional(c2sPayload *pb.C2SWrapper, regMethod pb.RegistrationSource, clientAddr []byte) error

RegisterUnidirectional process a unidirectional registration request and publish it to zmq

func (*RegProcessor) ReloadOverrides

func (p *RegProcessor) ReloadOverrides() error

ReloadOverrides allows the registrar to reload the configuration for the registration processing overrides when the registrar receives a SIGHUP signal for example. TODO: implement

func (*RegProcessor) ReloadSubnets

func (p *RegProcessor) ReloadSubnets() error

ReloadSubnets allows the registrar to reload the configuration for phantom address selection subnets when the registrar receives a SIGHUP signal for example. If it fails it reports and error and keeps the existing set of phantom subnets.

type Subnet added in v0.7.11

type Subnet struct {
	CIDR      Ipnet           `toml:"cidr"`
	Weight    float64         `toml:"weight"`
	Port      uint32          `toml:"port"`
	Transport string          `toml:"transport"`
	PrefixId  prefix.PrefixID `toml:"prefix_id"`
}

Jump to

Keyboard shortcuts

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