beats: github.com/elastic/beats/libbeat/common/flowhash Index | Files | Directories

package flowhash

import "github.com/elastic/beats/libbeat/common/flowhash"

Package flowhash provides the ability to hash flows.

Index

Package Files

communityid.go doc.go encoding.go flow.go hasher.go

Variables

var (
    // HexEncoding encodes the checksum in hexadecimal.
    HexEncoding = hexEncoding{}

    // Base64Encoding uses Base64 to encode the checksum, including
    // padding characters. This is the default for a Community ID.
    // This is an alias for the StdEncoding in the encoding/base64 package.
    Base64Encoding = base64.StdEncoding
)
var CommunityID = NewCommunityID(0, Base64Encoding, crypto.SHA1)

CommunityID is a flow hasher instance using the default values in the community ID specification.

type Encoding Uses

type Encoding interface {
    EncodeToString([]byte) string
}

Encoding is used to encode the flow hash.

type Flow Uses

type Flow struct {
    // SourceIP is the source IP address (required).
    SourceIP net.IP
    // DestinationIP is the destination IP address (required).
    DestinationIP net.IP
    // Protocol is the IP protocol (required).
    Protocol uint8
    // SourcePort is the source transport port.
    // This field is ignored in ICMP.
    SourcePort uint16
    // DestinationPort is the source transport port.
    // This field is ignored in ICMP.
    DestinationPort uint16
    // ICMP contains the ICMP flow information.
    ICMP struct {
        // Type is the ICMP type.
        Type uint8
        // Code is the ICMP code.
        Code uint8
    }
}

Flow is the representation of a flow.

type Hasher Uses

type Hasher interface {
    Hash(flow Flow) string
}

Hasher is an interface that provides a method to hash flows.

func NewCommunityID Uses

func NewCommunityID(seed uint16, encoder Encoding, hash crypto.Hash) Hasher

NewCommunityID allows to instantiate a flow hasher with custom settings.

Directories

PathSynopsis
examples

Package flowhash imports 7 packages (graph) and is imported by 27 packages. Updated 2018-12-16. Refresh now. Tools for package owners.