Socket
Book a DemoInstallSign in
Socket

vimagination.zapto.org/reverseproxy

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vimagination.zapto.org/reverseproxy

Go Modules
Version
v1.0.3
Version published
Created
Source

reverseproxy

-- import "vimagination.zapto.org/reverseproxy"

Package reverseproxy implements a basic HTTP/TLS connection forwarder based either the passed Host header or SNI extension.

Usage

var (
	ErrClosed = errors.New("closed")
)

Error.

var (
	ErrInvalidPort = errors.New("cannot register on port 0")
)

Errors.

type HostName

type HostName string

HostName represents an exact hostname to match on.

func (HostName) MatchService

func (h HostName) MatchService(serviceName string) bool

MatchService implements the MatchServiceName interface.

type HostNameSuffix

type HostNameSuffix string

HostNameSuffix represents a partial hostname to match the end on.

func (HostNameSuffix) MatchService

func (h HostNameSuffix) MatchService(serviceName string) bool

MatchService implements the MatchServiceName interface.

type Hosts

type Hosts []MatchServiceName

Hosts represents a list of service names to match against.

func (Hosts) MatchService

func (h Hosts) MatchService(serviceName string) bool

MatchService implements the MatchServiceName interface.

type MatchServiceName

type MatchServiceName interface {
	MatchService(string) bool
}

MatchServiceName allows differing ways of matching a service name to a service.

type Port

type Port struct {
}

Port represents a service waiting on a port.

func AddRedirect

func AddRedirect(serviceName MatchServiceName, port uint16, to net.Addr) (*Port, error)

AddRedirect sets a port to be redirected to an external service.

func (*Port) Close

func (p *Port) Close() error

Close closes this port connection.

func (*Port) Closed

func (p *Port) Closed() bool

Closed returns whether the port has been closed or not.

func (*Port) Status

func (p *Port) Status() Status

Status retrieves the status of a Port.

type Status

type Status struct {
	Ports           []uint16
	Closing, Active bool
}

Status constains the status of a Port.

type UnixCmd

type UnixCmd struct {
}

UnixCmd holds the information required to control (close) a server and its resources.

func RegisterCmd

func RegisterCmd(msn MatchServiceName, cmd *exec.Cmd) (*UnixCmd, error)

RegisterCmd runs the given command and waits for incoming listeners from it.

func (*UnixCmd) Close

func (u *UnixCmd) Close() error

Close closes all ports for the server and sends a signal to the server to close.

func (*UnixCmd) Status

func (u *UnixCmd) Status() Status

Status retrieves the Status of the UnixCmd.

FAQs

Package last updated on 15 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts