proxy

package
v0.0.0-...-c624de0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyBufferWithTimeout

func CopyBufferWithTimeout(dst io.Writer, src io.Reader, buf []byte) (written int64, err error)

CopyBufferWithTimeout is a copy of io.CopyBuffer but with retries on timeouts

func MakeProxyAuthMiddleware

func MakeProxyAuthMiddleware(next http.Handler, checkFunc AuthCheckFunc) http.Handler

Types

type AuthCheckFunc

type AuthCheckFunc func(usr, passwd string) bool

type AuthFuncOption

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

func WithAuthFunc

func WithAuthFunc(authFunc AuthCheckFunc) *AuthFuncOption

type DialerFactoryIface

type DialerFactoryIface interface {
	GetDialer() *net.Dialer
}

type GracefulShutdownTimeoutOption

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

func WithGracefulShutdownTimeout

func WithGracefulShutdownTimeout(timeout time.Duration) *GracefulShutdownTimeoutOption

type ListenAddrOption

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

func WithListenAddr

func WithListenAddr(addr string) *ListenAddrOption

type NetConnTimeoutReadWriter

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

NetConnTimeoutReadWriter sets net.Conn read/write deadlines on read

func (*NetConnTimeoutReadWriter) Read

func (rw *NetConnTimeoutReadWriter) Read(p []byte) (n int, err error)

func (*NetConnTimeoutReadWriter) Write

func (rw *NetConnTimeoutReadWriter) Write(p []byte) (n int, err error)

type Option

type Option interface {
	// contains filtered or unexported methods
}

type RandIpDialerFactory

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

RandIpDialerFactory provides dialer with random IP from provided network prefix

func MakeRandIpDialerFactory

func MakeRandIpDialerFactory(randReader *rand.Rand, prefix netip.Prefix) *RandIpDialerFactory

func (*RandIpDialerFactory) GetDialer

func (f *RandIpDialerFactory) GetDialer() *net.Dialer

type Server

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

func MakeServer

func MakeServer(dFactory DialerFactoryIface, options ...Option) *Server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts proxy HTTP server

type StaticDialerFactory

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

StaticDialerFactory provides user specified dialer if user provided dialer is unspecified provides empty dialer struct

func MakeNoIpDialerFactory

func MakeNoIpDialerFactory(dialer *net.Dialer) *StaticDialerFactory

func (*StaticDialerFactory) GetDialer

func (f *StaticDialerFactory) GetDialer() *net.Dialer

type WithHttpServerOption

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

func WithHttpServer

func WithHttpServer(httpServer *http.Server) *WithHttpServerOption

type WithHttpTransportOption

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

WithHttpTransportOption allows to set preconfigured HTTP transport when proxy serves non HTTPS (HTTP only) requests

func WithHttpTransport

func WithHttpTransport(transport *http.Transport) *WithHttpTransportOption

type WithLoggerOption

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

func WithLogger

func WithLogger(logger *zap.Logger) *WithLoggerOption

Jump to

Keyboard shortcuts

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