frpsvc

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frps

type Frps struct {
	// Control serves frp control's WebSocket, which httpsvc hands it
	// once it has checked the dark node's certificate: the upgraded
	// connection goes to frps in-process, not over loopback.
	Control http.Handler
	// Vhost is frps's site proxy, called in-process. The edge has already
	// parsed the request; it is not written to a port and parsed again.
	Vhost http.Handler
	// Stop shuts frps down.
	Stop func()
	// contains filtered or unexported fields
}

Frps is a running frps.

func Start

func Start(ctx context.Context, opts Options) (*Frps, error)

Start runs frps on loopback, and QUIC on public UDP 443 with opts.QUIC.

func (*Frps) Groups added in v0.6.0

func (f *Frps) Groups() map[string]int

Groups counts each dark node's logged-in frpc: the members of its group, which share its names.

func (*Frps) TCPRoute added in v0.7.0

func (f *Frps) TCPRoute(name string) (group.TCPTLSRoute, bool)

TCPRoute is name's TCP route, if it has one.

func (*Frps) WriteMetrics added in v0.3.0

func (f *Frps) WriteMetrics(w *metrics.Writer)

WriteMetrics writes the tunnel's metrics: dark nodes, logins, and the work connections that carry site requests.

type Options added in v0.3.0

type Options struct {
	// QUIC, when set, opens frp control on public UDP 443.
	QUIC *QUIC
	// HeaderTimeout is how long a visitor's request waits for the
	// origin's response headers when the request does not say
	// (vhost.WithResponseHeaderTimeout), in whole seconds; 0 is frp's
	// default.
	HeaderTimeout time.Duration
	// OnDomain is told when a name gains its first route and loses its last.
	OnDomain func(domain string, added bool)
	// OnTCPDomain is the same for TCP routes (tcp-tls proxies).
	OnTCPDomain func(domain string, added bool)
	// Tunnel is the name dark nodes log in on: no proxy may have it.
	Tunnel string
	// OnProxyError gets each site request frps could not proxy.
	OnProxyError func(*http.Request, error)
	// Node names the dark node of a tunnel connection's verified client
	// certificate, for the per-node session count.
	Node func(tls.ConnectionState) string
}

Options are how frps runs in the edge.

type QUIC

type QUIC struct {
	ClientCA    string // PEM file of the CA that signs dark-node certificates
	Certificate func(*tls.ClientHelloInfo) (*tls.Certificate, error)
	// Verify runs after the client certificate chain verified; an error
	// refuses the connection.
	Verify func(tls.ConnectionState) error
}

QUIC is frps's public listener on UDP 443.

Jump to

Keyboard shortcuts

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