proxy

package
v0.0.0-...-71be35f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MemoryStorage describes in-memory data storage.
	MemoryStorage = ":memory:"
)
View Source
const SO_ORIGINAL_DST = 0x50

Variables

View Source
var DialerDirect = netproxy.Direct

DialerDirect is a direct proxy: one that makes network connections directly, good for testing

Functions

func NewDialerHTTPConnect

func NewDialerHTTPConnect(forwardDialer netproxy.Dialer, forwardUrl *url.URL, user, pass, country string) *dialerHTTPConnect

NewDialerHTTPConnect returns a new Dialer that dials through the provided proxy server's network and address.

func NewDomainTracer

func NewDomainTracer() *domainTracer

NewDomainTracer creates new domain tracer instace.

func NewNoopTracer

func NewNoopTracer() *noopTracer

NewNoopTracer creates new noop domain tracer instace.

func NewServer

func NewServer(
	allowedSubnets []*net.IPNet,
	allowedIPs []net.IP,
	upstreamDialer netproxy.Dialer,
	mapper StickyMapper,
	dt domainTracker,
	portMap map[string]string,
	handlerMiddleware HandlerMiddleware,
) *proxyServer

NewServer returns new instance of HTTP transparent proxy server

func NewStickyMapper

func NewStickyMapper(path string) (*stickyMapper, error)

NewStickyMapper creates database for storing IP to UserID mapping.

Types

type Connection

type Connection struct {
	net.Conn
	// contains filtered or unexported fields
}

Connection wraps net.Conn to provide extra method for establishing CONNECT session.

func (*Connection) ConnectTo

func (c *Connection) ConnectTo(conn io.ReadWriter, address string, userID string) error

ConnectTo establishes new CONNECT session within existing connection. It allows to pass UserID to enable sticky sessions.

type Context

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

Context is the Proxy context, contains useful information about every request.

func (*Context) BytesReceived

func (c *Context) BytesReceived() int64

func (*Context) BytesSent

func (c *Context) BytesSent() int64

type HandlerMiddleware

type HandlerMiddleware func(func(c *Context), string) func(*Context)

type Listener

type Listener interface {
	OnProxyConnectionAccept()
}

type StickyMapper

type StickyMapper interface {
	Save(ip, userID string)
	Hash(ip string) (hash string)
}

StickyMapper represent connection stickiness storage.

Jump to

Keyboard shortcuts

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