rnet

package
v0.0.0-...-99b537f Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// type of services
	SVCSOCKS5 = "svcsocks5" // SOCKS5
	SVCHTTP   = "svchttp"   // HTTP
	PXSOCKS5  = "pxsocks5"  // SOCKS5 with forwarding proxy
	PXHTTP    = "pxhttp"    // HTTP with forwarding proxy

	// status of proxies
	SUP = 0  // svc UP
	SOK = 1  // svc OK
	SKO = -1 // svc not OK
	END = -2 // svc stopped
)

Variables

This section is empty.

Functions

func NewServices

func NewServices(pctx context.Context, proxies ipn.Proxies, ctl protect.Controller, listener ServerListener) *services

Types

type AuthHandle

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

type Server

type Server interface {
	// Sets the proxy as the next hop.
	Hop(p x.Proxy) error
	// ID returns the ID of the server.
	ID() string
	// Start starts the server.
	Start() error
	// Type returns the type of the server.
	Type() string
	// Addr returns the address of the server.
	GetAddr() string
	// Status returns the status of the server.
	Status() int
	// Stop stops the server.
	Stop() error
	// Refresh re-registers the server.
	Refresh() error
}

type ServerListener

type ServerListener interface {
	// Route decides how to forward an incoming connection over service (sid).
	Route(sid, pid, network, sipport, dipport string) *Tab
	// OnComplete reports summary after a connection closes.
	OnComplete(*ServerSummary)
}

ServerListener receives Server events.

type ServerSummary

type ServerSummary struct {
	Type     string // http1, socks5, etc.
	SID      string // Server id
	PID      string // Proxy ID (hop) that handled egress, if any.
	CID      string // Connection id
	Tx       int    // Amount uploaded (bytes).
	Rx       int    // Amount downloaded (bytes).
	Duration int32  // Conn open duration (seconds).

	Msg string // Error message, if any.
	// contains filtered or unexported fields
}

Summary is a summary of a DNS transaction, reported when it is complete.

func (*ServerSummary) String

func (s *ServerSummary) String() string

type Services

type Services interface {
	// Add adds a server.
	AddServer(id, url string) (Server, error)
	// Bridge bridges or unbridges server with proxy.
	Bridge(serverid, proxyid string) error
	// Remove removes a server.
	RemoveServer(id string) (ok bool)
	// RemoveAll removes all servers.
	RemoveAll()
	// Get returns a Server.
	GetServer(id string) (Server, error)
	// Refresh re-registers servces and returns a csv of active ones.
	RefreshServers() (active string)
}

type Tab

type Tab struct {
	CID   string // CID is the ID of this connection.
	Block bool   // Block is true if this connection should be blocked.
}

Jump to

Keyboard shortcuts

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