proxy

package
v0.0.0-...-d981aca Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotSupported        = errors.New("method not supported")
	ErrProxyBusy           = errors.New("proxy is busy")
	ErrProxyNotInitialized = errors.New("proxy is not initialized")
	ErrNotImplemented      = errors.New("proxy method not implemented")
)
View Source
var Registry = ProxyRegistry{/* contains filtered or unexported fields */}

Functions

This section is empty.

Types

type BaseConn

type BaseConn struct {
	LocalAddress  *ProxyAddr
	RemoteAddress *ProxyAddr
}

func (*BaseConn) Close

func (c *BaseConn) Close() error

func (*BaseConn) LocalAddr

func (c *BaseConn) LocalAddr() net.Addr

func (*BaseConn) Read

func (c *BaseConn) Read(b []byte) (int, error)

func (*BaseConn) RemoteAddr

func (c *BaseConn) RemoteAddr() net.Addr

func (*BaseConn) SetDeadline

func (c *BaseConn) SetDeadline(t time.Time) error

func (*BaseConn) SetReadDeadline

func (c *BaseConn) SetReadDeadline(t time.Time) error

func (*BaseConn) SetWriteDeadline

func (c *BaseConn) SetWriteDeadline(t time.Time) error

func (*BaseConn) Write

func (c *BaseConn) Write(b []byte) (int, error)

type ProxyAddr

type ProxyAddr struct {
	url.URL
}

func ParseAddr

func ParseAddr(raw string) (*ProxyAddr, error)

func (*ProxyAddr) GetBoolOption

func (a *ProxyAddr) GetBoolOption(key string, fallback bool) (bool, error)

func (*ProxyAddr) GetIntOption

func (a *ProxyAddr) GetIntOption(key string, base int, fallback int) (int, error)

func (*ProxyAddr) GetStringOption

func (a *ProxyAddr) GetStringOption(key, fallback string) string

func (*ProxyAddr) Network

func (a *ProxyAddr) Network() string

func (*ProxyAddr) ProxyScheme

func (a *ProxyAddr) ProxyScheme() ProxyScheme

func (*ProxyAddr) String

func (a *ProxyAddr) String() string

type ProxyDescription

type ProxyDescription struct {
	Scheme           ProxyScheme
	Description      string
	Examples         []string
	SupportsMultiple bool
	SupportsStreams  bool

	StringOptions []ProxyOption[string]
	BoolOptions   []ProxyOption[bool]
	IntOptions    []ProxyOption[int]

	Dialer   ProxyDialer
	Listener ProxyListener
	// contains filtered or unexported fields
}

func (*ProxyDescription) Connect

func (p *ProxyDescription) Connect(ctx context.Context) (net.Conn, error)

func (*ProxyDescription) GetBoolOption

func (p *ProxyDescription) GetBoolOption(key string) bool

func (*ProxyDescription) GetIntOption

func (p *ProxyDescription) GetIntOption(key string, base int) int

func (*ProxyDescription) GetStringOption

func (p *ProxyDescription) GetStringOption(key string) string

func (*ProxyDescription) Help

func (ep *ProxyDescription) Help() string

func (*ProxyDescription) IsListener

func (p *ProxyDescription) IsListener() bool

func (*ProxyDescription) SetAddr

func (p *ProxyDescription) SetAddr(addr *ProxyAddr) *ProxyDescription

func (*ProxyDescription) Target

func (p *ProxyDescription) Target() *ProxyAddr

func (*ProxyDescription) TargetHost

func (p *ProxyDescription) TargetHost() string

type ProxyDialer

type ProxyDialer interface {
	Dial(ctx context.Context, desc *ProxyDescription) (net.Conn, error)
}

type ProxyListener

type ProxyListener interface {
	IsListening() bool
	Listen(desc *ProxyDescription) error
	Accept() (net.Conn, error)
	Close() error
}

type ProxyOption

type ProxyOption[T ProxyOptionType] struct {
	Name        string
	Description string
	Default     T
}

type ProxyOptionType

type ProxyOptionType interface {
	string | bool | int
}

type ProxyRegistry

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

func (*ProxyRegistry) Add

func (r *ProxyRegistry) Add(desc ProxyDescription)

func (*ProxyRegistry) FindAndCreateProxy

func (r *ProxyRegistry) FindAndCreateProxy(addr *ProxyAddr) (*ProxyDescription, error)

func (ProxyRegistry) Get

func (ProxyRegistry) Keys

func (r ProxyRegistry) Keys() []ProxyScheme

func (ProxyRegistry) Values

func (r ProxyRegistry) Values() []ProxyDescription

type ProxyScheme

type ProxyScheme string

func (ProxyScheme) IsListener

func (s ProxyScheme) IsListener() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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