proxy

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2017 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial() (net.Conn, error)
	Close() error
}

Dialer establishes a working connection with the remote service.

type Proxy

type Proxy interface {
	ID() string
	Close() error
	Bind(Dialer) error
	Unbind(Dialer) error
	Accept() (net.Conn, error)
	Handle(net.Conn, Traffic) error
}

Proxy combination listener and dialer.

func Wrap

func Wrap(id string, listener net.Listener) Proxy

Wrap a net.Listener to create a Proxy.

type Service

type Service struct {
	Traff Traffic
	// contains filtered or unexported fields
}

Service manages all proxies, and handles all user connections, and records all incoming and outgoing traffic.

func (*Service) Kill

func (s *Service) Kill(id string)

Kill a proxy.

func (*Service) Load

func (s *Service) Load(id string) (p Proxy, ok bool)

Load returns a proxy.

func (*Service) Proxies

func (s *Service) Proxies() (proxies []Proxy)

Proxies returns all proxies.

func (*Service) Proxy

func (s *Service) Proxy(p Proxy) (err error)

Proxy listens for a new proxy.

func (*Service) Register

func (s *Service) Register(id string, dialer Dialer) (err error)

Register a dialer and bind to the proxy.

func (*Service) Serve

func (s *Service) Serve(ctx context.Context) (err error)

Serve all proxies.

func (*Service) Unregister

func (s *Service) Unregister(id string, dialer Dialer) (err error)

Unregister a dialer and unbind from the proxy.

type Traffic

type Traffic interface {
	In(id string, b []byte)
	Out(id string, b []byte)
}

Traffic is used to record incoming and outgoing traffic.

Jump to

Keyboard shortcuts

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