proxylib

package
v0.0.0-...-adc2169 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2018 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (
	ConnectionClosedErr             = "use of closed network connection"
	ConnectionResetErr              = "connection reset by peer"
	DefaultMaxTeardownTimeInSeconds = 10
)
View Source
const SO_ORIGINAL_DST = 80

Variables

This section is empty.

Functions

func CloseConnection

func CloseConnection(cnx io.Closer, log Logger, id string, name string)

func FerryBytes

func FerryBytes(
	client *net.TCPConn,
	server *net.TCPConn,
	cnxId string,
	maxTeardownTimeInSecs int,
)

FerryBytes copies bytes between two sockets. Tries to handle disconnections safely. When one socket disconnects, a CloseWrite() is done to the other socket, and a teardown timer started with the specified timeout value (if value is zero, a default value of 10 seconds is used). If a graceful disconnect from the other socket is not detected within that period, the other end is forcefully closed.

func OriginalDestination

func OriginalDestination(cnxId string, conn *net.Conn) (string, error)

OriginalDestination returns an intercepted connection's original destination. Adapted from https://play.golang.org/p/GMAaKucHOr

func RandomString

func RandomString(strlen int) string

Types

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
}

Jump to

Keyboard shortcuts

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