Versions in this module Expand all Collapse all v0 v0.53.9 Dec 22, 2023 v0.53.8 Dec 22, 2023 v0.53.7 Dec 22, 2023 v0.53.6 Dec 16, 2023 v0.53.5 Dec 16, 2023 v0.53.4 Dec 16, 2023 v0.53.3 Dec 16, 2023 v0.53.2 Dec 16, 2023 Changes in this version + const BehaviorBothChanged + const BehaviorIPChanged + const BehaviorNoChange + const BehaviorPortChanged + const EasyNAT + const HardNAT + var DetectMode0 = 0 + var DetectMode1 = 1 + var DetectMode2 = 2 + var DetectMode3 = 3 + var DetectMode4 = 4 + var DetectRoleReceiver = "receiver" + var DetectRoleSender = "sender" + var NatHoleTimeout int64 = 10 + var SupportedModes = []int + var SupportedRoles = []string + func ClassifyFeatureCount(features []*NatFeature) (int, int, int) + func DecodeMessageInto(data, key []byte, m msg.Message) error + func Discover(stunServers []string, localAddr string) ([]string, net.Addr, error) + func EncodeMessage(m msg.Message, key []byte) ([]byte, error) + func ExchangeInfo(ctx context.Context, transporter transport.MessageTransporter, laneKey string, ...) (*msg.NatHoleResp, error) + func ListAllLocalIPs() ([]net.IP, error) + func ListLocalIPsForNatHole(max int) ([]string, error) + func MakeHole(ctx context.Context, listenConn *net.UDPConn, m *msg.NatHoleResp, key []byte) (*net.UDPConn, *net.UDPAddr, error) + func NewTransactionID() string + func PreCheck(ctx context.Context, transporter transport.MessageTransporter, ...) error + type Analyzer struct + func NewAnalyzer(dataReserveDuration time.Duration) *Analyzer + func (a *Analyzer) Clean() (int, int) + func (a *Analyzer) GetRecommandBehaviors(key string, c, v *NatFeature) (mode, index int, _ RecommandBehavior, _ RecommandBehavior) + func (a *Analyzer) ReportSuccess(key string, mode, index int) + type BehaviorScore struct + Index int + Mode int + Score int + type ChangedAddress struct + IP net.IP + Port int + func (s *ChangedAddress) GetFrom(m *stun.Message) error + func (s *ChangedAddress) String() string + type ClientCfg struct + type Controller struct + func NewController(analysisDataReserveDuration time.Duration) (*Controller, error) + func (c *Controller) CleanWorker(ctx context.Context) + func (c *Controller) CloseClient(name string) + func (c *Controller) GenNatHoleResponse(transactionID string, session *Session, errInfo string) *msg.NatHoleResp + func (c *Controller) GenSid() string + func (c *Controller) HandleClient(m *msg.NatHoleClient, transporter transport.MessageTransporter) + func (c *Controller) HandleReport(m *msg.NatHoleReport) + func (c *Controller) HandleVisitor(m *msg.NatHoleVisitor, transporter transport.MessageTransporter, ...) + func (c *Controller) ListenClient(name string, sk string, allowUsers []string) (chan string, error) + type MakeHoleRecords struct + LastUpdateTime time.Time + func NewMakeHoleRecords(c, v *NatFeature) *MakeHoleRecords + func (mhr *MakeHoleRecords) Recommand() (mode, index int) + func (mhr *MakeHoleRecords) ReportSuccess(mode int, index int) + type Message struct + Addr string + Body []byte + type NatFeature struct + Behavior string + NatType string + PortsDifference int + PublicNetwork bool + RegularPortsChange bool + func ClassifyNATFeature(addresses []string, localIPs []string) (*NatFeature, error) + type PrepareResult struct + Addrs []string + AssistedAddrs []string + Behavior string + ListenConn *net.UDPConn + NatType string + func Prepare(stunServers []string) (*PrepareResult, error) + type RecommandBehavior struct + ListenRandomPorts int + PortsRandomNumber int + PortsRangeNumber int + Role string + SendDelayMs int + TTL int + type Session struct