rnet

package
v0.0.0-...-5849f3d Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MPL-2.0 Imports: 15 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

This section is empty.

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.

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, returns the number removed.
	RemoveAll() (rm int)
	// Get returns a Server.
	GetServer(id string) (Server, error)
	// Stop stops all services, returns the number stopped.
	StopServers() (n int)
	// Refresh re-registers servces and returns a csv of active ones.
	RefreshServers() (active string)
}

func NewServices

func NewServices(proxies ipn.Proxies, ctl protect.Controller, listener ServerListener) Services

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