atproxy

package module
v0.0.0-...-f89c271 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

README

atproxy

Auto-routing socks5 and http proxy server

installation

go install github.com/reusee/atproxy/atproxy@master

check atproxy/atproxy.py for configuration example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BytesPool

type BytesPool struct {
	*pr3.Pool[[]byte]
}

type BytesPoolBufferSize

type BytesPoolBufferSize int

type BytesPoolCapacity

type BytesPoolCapacity int

type ClientSemaphore

type ClientSemaphore chan struct{}

type DialContext

type DialContext = func(ctx context.Context, addr, network string) (net.Conn, error)

type DialTimeout

type DialTimeout time.Duration

type Dialer

type Dialer struct {
	DialContext DialContext
	Name        string
	Addr        string
	Deny        *regexp.Regexp
}

type Dialers

type Dialers []*Dialer

func (Dialers) IsReducer

func (Dialers) IsReducer()

type GetPenalty

type GetPenalty func(dialer *Dialer, hostPort string) time.Duration

type Global

type Global struct {
	Scope Scope
}

func NewGlobal

func NewGlobal(defs ...any) *Global

func (Global) BytesPool

func (Global) BytesPool(
	capacity BytesPoolCapacity,
	size BytesPoolBufferSize,
) BytesPool

func (Global) BytesPoolBufferSize

func (Global) BytesPoolBufferSize() BytesPoolBufferSize

func (Global) BytesPoolCapacity

func (Global) BytesPoolCapacity() BytesPoolCapacity

func (*Global) NewServer

func (g *Global) NewServer() NewServer

func (Global) TailscaleDial

func (Global) TailscaleDial(
	tsServer *tsnet.Server,
) TailscaleDial

func (Global) TsServer

func (Global) TsServer() *tsnet.Server

type HandleConn

type HandleConn func(
	parentCtx context.Context,
	conn net.Conn,
	hostPort string,
)

type HandleRequest

type HandleRequest func(
	parentCtx context.Context,
	req *http.Request,
	w http.ResponseWriter,
)

type IdleTimeout

type IdleTimeout time.Duration

type MaxClients

type MaxClients int

type NewServer

type NewServer func(defSets ...[]any) *Server

type NoDirect

type NoDirect bool

type NoDirectPatterns

type NoDirectPatterns []string

type NoUpstreamPatterns

type NoUpstreamPatterns []string

type OnNotSelected

type OnNotSelected func(
	dialer *Dialer,
	hostPort string,
)

func (OnNotSelected) IsReducer

func (OnNotSelected) IsReducer()

type OnSelected

type OnSelected func(
	dialer *Dialer,
	hostPort string,
)

func (OnSelected) IsReducer

func (OnSelected) IsReducer()

type OutboundPacket

type OutboundPacket struct {
	Data []byte
	Put  func() bool
}

type Scope

type Scope = dscope.Scope

type Serve

type Serve func(
	ctx context.Context,
	socksLn *net.TCPListener,
	httpLn *net.TCPListener,
) (
	err error,
)

type Server

type Server struct {
	Scope Scope
}

func (Server) ClientSemaphore

func (Server) ClientSemaphore(
	max MaxClients,
) ClientSemaphore

func (Server) DialTimeout

func (Server) DialTimeout() DialTimeout

func (Server) DirectDialer

func (Server) DirectDialer(
	noDirectPatterns NoDirectPatterns,
	noDirect NoDirect,
) Dialers

func (Server) HTTPTransports

func (Server) HTTPTransports(
	dialers Dialers,
) (transports []*http.Transport)

func (Server) HandleConn

func (Server) HandleConn(
	dialers Dialers,
	_idleTimeout IdleTimeout,
	bytesPool BytesPool,
	onSelected OnSelected,
	onNotSelected OnNotSelected,
	getPenalty GetPenalty,
) HandleConn

func (Server) HandleRequest

func (Server) HandleRequest(
	transports []*http.Transport,
	bytesPool BytesPool,
) HandleRequest

func (Server) IdleTimeout

func (Server) IdleTimeout() IdleTimeout

func (Server) MaxClients

func (Server) MaxClients() MaxClients

func (Server) NoDirect

func (Server) NoDirect() NoDirect

func (Server) NoDirectPatterns

func (Server) NoDirectPatterns() NoDirectPatterns

func (Server) NoUpstreamPatterns

func (Server) NoUpstreamPatterns() NoUpstreamPatterns

func (Server) OnNotSelected

func (Server) OnNotSelected() OnNotSelected

func (Server) OnSelected

func (Server) OnSelected() OnSelected

func (Server) Penalty

func (Server) Penalty() (
	onSelected OnSelected,
	onNotSelected OnNotSelected,
	get GetPenalty,
)

func (Server) Serve

func (Server) Serve(
	clientSem ClientSemaphore,
	handleRequest HandleRequest,
	handleConn HandleConn,
) Serve

func (Server) UpstreamDialers

func (Server) UpstreamDialers(
	upstreams Upstreams,
	noUpstreamPatterns NoUpstreamPatterns,
	tailscaleDial TailscaleDial,
) (dialers Dialers)

func (Server) Upstreams

func (Server) Upstreams() Upstreams

type TailscaleDial

type TailscaleDial func(ctx context.Context, network, addr string) (net.Conn, error)

type Upstream

type Upstream struct {
	Name        string
	DialContext DialContext
	Network     string
	Addr        string
	User        string
	Password    string
	IsTailscale bool
}

type Upstreams

type Upstreams []*Upstream

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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