proxy

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Direct = &direct{}

Direct proxy

Functions

func RegisterDialer

func RegisterDialer(name string, c DialerCreator)

RegisterDialer is used to register a dialer

func RegisterServer

func RegisterServer(name string, c ServerCreator)

RegisterServer is used to register a proxy server

Types

type Dialer

type Dialer interface {
	// Addr()
	Addr() string

	// Dial connects to the given address via the proxy.
	Dial(network, addr string) (c net.Conn, err error)

	// DialUDP connects to the given address via the proxy.
	DialUDP(network, addr string) (pc net.PacketConn, writeTo net.Addr, err error)

	// Get the dialer by dstAddr
	NextDialer(dstAddr string) Dialer
}

Dialer means to establish a connection and relay it.

func DialerFromURL

func DialerFromURL(s string, dialer Dialer) (Dialer, error)

DialerFromURL calls the registered creator to create dialers.

type DialerCreator

type DialerCreator func(s string, dialer Dialer) (Dialer, error)

DialerCreator is a function to create dialers.

type Server

type Server interface {
	// ListenAndServe as proxy server, use only in server mode.
	ListenAndServe()
}

Server interface

func ServerFromURL

func ServerFromURL(s string, dialer Dialer) (Server, error)

ServerFromURL calls the registered creator to create proxy servers.

type ServerCreator

type ServerCreator func(s string, dialer Dialer) (Server, error)

ServerCreator is a function to create proxy servers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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