reverseproxy

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: ISC Imports: 14 Imported by: 0

README

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 servicenames 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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

Error

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

Errors

Functions

This section is empty.

Types

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 servicenames 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 {
	// contains filtered or unexported fields
}

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 {
	// contains filtered or unexported fields
}

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

Directories

Path Synopsis
cmd
Package unixconn facilitates creating reverse proxy connections
Package unixconn facilitates creating reverse proxy connections

Jump to

Keyboard shortcuts

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