dialchain

package
v6.0.0-beta2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: Apache-2.0 Imports: 7 Imported by: 320

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DialerChain

type DialerChain struct {
	Net    NetDialer
	Layers []Layer
}

DialerChain composes builders for multiple network layers, used to build the final transport.Dialer object based on the network layers. Each layer can hold individual configurations. Use 'Clone' to copy and replace/wrap layers at will. Once all Layers have been prepared, use Build to build a transport.Dialer that can used with any go library network packages relying on standard library based dialers.

For Additional Layering capabilities, DialerChain implements the NetDialer interface.

func (*DialerChain) AddLayer

func (c *DialerChain) AddLayer(l Layer)

AddLayer adds another layer to the dialer chain. The layer being added is the new topmost network layer using the other already present layers on dial.

func (*DialerChain) Build

func (c *DialerChain) Build(event common.MapStr) (d transport.Dialer, err error)

Build create a new transport.Dialer for use with other networking libraries.

func (*DialerChain) Clone

func (c *DialerChain) Clone() *DialerChain

Clone create a shallow copy of c.

func (*DialerChain) TestBuild

func (c *DialerChain) TestBuild() error

TestBuild tries to build the DialerChain and reports any error reported by one of the layers.

type Layer

Layer is a configured network layer, wrapping any lower-level network layers.

func ConstAddrLayer

func ConstAddrLayer(address string) Layer

ConstAddrLayer introduces a network layer always passing a constant address to the underlying layer.

func IDLayer

func IDLayer() Layer

IDLayer creates an empty placeholder layer.

func MakeConstAddrLayer

func MakeConstAddrLayer(addr string, origLayer Layer) Layer

MakeConstAddrLayer always passes the same address to the original Layer. This is usefull if a lookup did return multiple IPs for the same hostname, but the IP use to connect shall be fixed.

func SOCKS5Layer

func SOCKS5Layer(config *transport.ProxyConfig) Layer

SOCKS5Layer configures a SOCKS5 proxy layer in a DialerChain.

The layer will update the active event with:

{
  "socks5": {
      "rtt": { "connect": { "us": ... }}
  }
}

func TLSLayer

func TLSLayer(cfg *transport.TLSConfig, to time.Duration) Layer

TLSLayer configures the TLS layer in a DialerChain.

The layer will update the active event with:

{
  "tls": {
      "rtt": { "handshake": { "us": ... }}
  }
}

type NetDialer

type NetDialer func(common.MapStr) (transport.Dialer, error)

NetDialer provides the most low-level network layer for setting up a network connection. NetDialer objects do not support wrapping any lower network layers.

func MakeConstAddrDialer

func MakeConstAddrDialer(addr string, origNet NetDialer) NetDialer

MakeConstAddrDialer always passes the same address to the original NetDialer. This is usefull if a lookup did return multiple IPs for the same hostname, but the IP use to connect shall be fixed.

func TCPDialer

func TCPDialer(to time.Duration) NetDialer

TCPDialer creates a new NetDialer with constant event fields and default connection timeout. The fields parameter holds additonal constants to be added to the final event structure.

The dialer will update the active events with:

{
  "tcp": {
    "port": ...,
    "rtt": { "connect": { "us": ... }}
  }
}

func UDPDialer

func UDPDialer(to time.Duration) NetDialer

UDPDialer creates a new NetDialer with constant event fields and default connection timeout. The fields parameter holds additonal constants to be added to the final event structure.

The dialer will update the active events with:

{
  "udp": {
    "port": ...,
    "rtt": { "connect": { "us": ... }}
  }
}

Jump to

Keyboard shortcuts

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