nats

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Blocked              = "Blocked"
	OpenInternet         = "Open Internet"
	FullCone             = "Full Cone"
	SymmetricUDPFirewall = "Symmetric UDP Firewall"
	RestricNAT           = "Restric NAT"
	RestricPortNAT       = "Restric Port NAT"
	SymmetricNAT         = "Symmetric NAT"
)

Variables

This section is empty.

Functions

func NewAttrChangeRequest

func NewAttrChangeRequest() attrChangeRequest

Types

type Config

type Config struct {
	Server  string
	Verbose bool
	Local   string
	Net     *vnet.Net
}

Config has config parameters for NewNATS.

type DiscoverResult

type DiscoverResult struct {
	IsNatted          bool                   `json:"isNatted"`
	MappingBehavior   EndpointDependencyType `json:"mappingBehavior"`
	FilteringBehavior EndpointDependencyType `json:"filteringBehavior"`
	PortPreservation  bool                   `json:"portPreservation"`
	NATType           string                 `json:"natType"`
	ExternalIP        string                 `json:"externalIP"`
	ExternalPort      string                 `json:"externalPort"`
}

DiscoverResult contains a set of results from Discover method.

type EndpointDependencyType

type EndpointDependencyType uint8

EndpointDependencyType ...

const (
	// EndpointIndependent means the behavior is independent of the endpoint's address or port
	EndpointIndependent EndpointDependencyType = iota
	// EndpointAddrDependent means the behavior is dependent on the endpoint's address
	EndpointAddrDependent
	// EndpointAddrPortDependent means the behavior is dependent on the endpoint's address and port
	EndpointAddrPortDependent
	// EndpointUndefined ...
	EndpointUndefined
)

func (EndpointDependencyType) String

func (t EndpointDependencyType) String() string

type NATS

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

NATS a class supports NAT type discovery feature.

func NewNATS

func NewNATS(config *Config) (*NATS, error)

NewNATS creats a new instance of NATS.

func (*NATS) Discover

func (nats *NATS) Discover() (*DiscoverResult, error)

Discover performs NAT discovery process defined in RFC 5780.

type STUNServer

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

func NewSTUNServer

func NewSTUNServer(config *STUNServerConfig) (*STUNServer, error)

func (*STUNServer) Close

func (s *STUNServer) Close() error

func (*STUNServer) Start

func (s *STUNServer) Start() error

func (*STUNServer) StartListenServer

func (s *STUNServer) StartListenServer()

type STUNServerConfig

type STUNServerConfig struct {
	PrimaryAddress   string
	SecondaryAddress string
	Net              *vnet.Net
	Role             string
	Pri2SecHost      string
}

Jump to

Keyboard shortcuts

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