internal

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: BSD-3-Clause Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ReloadInterval = getEnvAsDuration("NP_RELOAD_INTERVAL", 1*time.Hour)
)

Functions

func NewTLSConfig added in v1.15.0

func NewTLSConfig() (*tls.Config, error)

Types

type Client

type Client struct{ Common }

func NewClient

func NewClient(parsedURL *url.URL, logger *logs.Logger) (*Client, error)

func (*Client) Run

func (c *Client) Run()

type Common

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

type Instance

type Instance struct {
	ID         string `json:"id"`
	Alias      string `json:"alias"`
	Type       string `json:"type"`
	Status     string `json:"status"`
	URL        string `json:"url"`
	Config     string `json:"config"`
	Restart    bool   `json:"restart"`
	Meta       Meta   `json:"meta"`
	Mode       int32  `json:"mode"`
	Ping       int32  `json:"ping"`
	Pool       int32  `json:"pool"`
	TCPS       int32  `json:"tcps"`
	UDPS       int32  `json:"udps"`
	TCPRX      uint64 `json:"tcprx"`
	TCPTX      uint64 `json:"tcptx"`
	UDPRX      uint64 `json:"udprx"`
	UDPTX      uint64 `json:"udptx"`
	TCPRXBase  uint64 `json:"-" gob:"-"`
	TCPTXBase  uint64 `json:"-" gob:"-"`
	UDPRXBase  uint64 `json:"-" gob:"-"`
	UDPTXBase  uint64 `json:"-" gob:"-"`
	TCPRXReset uint64 `json:"-" gob:"-"`
	TCPTXReset uint64 `json:"-" gob:"-"`
	UDPRXReset uint64 `json:"-" gob:"-"`
	UDPTXReset uint64 `json:"-" gob:"-"`
	// contains filtered or unexported fields
}

type InstanceEvent

type InstanceEvent struct {
	Type     string    `json:"type"`
	Time     time.Time `json:"time"`
	Instance *Instance `json:"instance"`
	Logs     string    `json:"logs"`
}

type InstanceLogWriter

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

func NewInstanceLogWriter

func NewInstanceLogWriter(instanceID string, instance *Instance, target io.Writer, master *Master) *InstanceLogWriter

func (*InstanceLogWriter) Write

func (w *InstanceLogWriter) Write(p []byte) (n int, err error)

type Master

type Master struct {
	Common
	// contains filtered or unexported fields
}

func NewMaster

func NewMaster(parsedURL *url.URL, tlsCode string, tlsConfig *tls.Config, logger *logs.Logger, version string) (*Master, error)

func (*Master) Run

func (m *Master) Run()

func (*Master) Shutdown

func (m *Master) Shutdown(ctx context.Context) error

type Meta

type Meta struct {
	Peer Peer              `json:"peer"`
	Tags map[string]string `json:"tags"`
}

type Peer

type Peer struct {
	SID   string `json:"sid"`
	Type  string `json:"type"`
	Alias string `json:"alias"`
}

type Server

type Server struct{ Common }

func NewServer

func NewServer(parsedURL *url.URL, tlsCode string, tlsConfig *tls.Config, logger *logs.Logger) (*Server, error)

func (*Server) Run

func (s *Server) Run()

type Signal

type Signal struct {
	ActionType  string `json:"action"`
	RemoteAddr  string `json:"remote,omitempty"`
	PoolConnID  string `json:"id,omitempty"`
	Fingerprint string `json:"fp,omitempty"`
}

type SystemInfo

type SystemInfo struct {
	CPU       int    `json:"cpu"`
	MemTotal  uint64 `json:"mem_total"`
	MemUsed   uint64 `json:"mem_used"`
	SwapTotal uint64 `json:"swap_total"`
	SwapUsed  uint64 `json:"swap_used"`
	NetRX     uint64 `json:"netrx"`
	NetTX     uint64 `json:"nettx"`
	DiskR     uint64 `json:"diskr"`
	DiskW     uint64 `json:"diskw"`
	SysUp     uint64 `json:"sysup"`
}

type TCPingResult

type TCPingResult struct {
	Target    string  `json:"target"`
	Connected bool    `json:"connected"`
	Latency   int64   `json:"latency"`
	Error     *string `json:"error"`
}

type TransportPool

type TransportPool interface {
	IncomingGet(timeout time.Duration) (string, net.Conn, error)
	OutgoingGet(id string, timeout time.Duration) (net.Conn, error)
	Flush()
	Close()
	Ready() bool
	Active() int
	Capacity() int
	Interval() time.Duration
	AddError()
	ErrorCount() int
	ResetError()
}

Jump to

Keyboard shortcuts

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