connection

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package connection provides a struct to encode a single TCP connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	RemoteIP   string
	RemotePort int
	LocalIP    string
	LocalPort  int
	Cookie     string
}

Connection models a single connection. This type is checked for equality elsewhere in traceroute-caller, so be very careful adding more fields as you might accidentally change program semantics elsewhere.

func (*Connection) UUID

func (c *Connection) UUID() (string, error)

UUID returns uuid from cookie parsed from "ss -e" output.

type Creator added in v0.2.1

type Creator interface {
	FromSockID(sockid inetdiag.SockID) (Connection, error)
}

Creator allows you to create a connection object from a SockID. It properly assigns SrcIP and DestIP to RemoteIP and LocalIP.

func NewCreator added in v0.2.1

func NewCreator() (Creator, error)

NewCreator makes an object that can convert src and dst into local and remote IPs.

func NewFakeCreator added in v0.2.1

func NewFakeCreator(localIPs []*net.IP) Creator

NewFakeCreator makes a fake creator with hardcoded local IPs to enable testing in diverse network environments.

Jump to

Keyboard shortcuts

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