netutils

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: AGPL-3.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBroadcastAddress added in v0.8.13

func GetBroadcastAddress(ip net.IP, netMask net.IPMask) net.IP

GetBroadcastAddress returns the broadcast address of the given IP and network mask. If a mixed IPv4/IPv6 input is given, it returns nil.

func IPPortFromAddr added in v1.4.6

func IPPortFromAddr(addr net.Addr) (ip net.IP, port uint16, err error)

IPPortFromAddr extracts or parses the IP address and port contained in the given address.

func IPsToRRs added in v0.4.12

func IPsToRRs(domain string, ips []net.IP) ([]dns.RR, error)

IPsToRRs transforms the given IPs to resource records.

func IsValidFqdn

func IsValidFqdn(fqdn string) bool

IsValidFqdn returns whether the given string is a valid fqdn.

func ParseIPPort added in v1.4.6

func ParseIPPort(address string) (net.IP, uint16, error)

ParseIPPort parses a <ip>:port formatted address.

func ProtocolFromNetwork added in v1.4.6

func ProtocolFromNetwork(net string) (protocol packet.IPProtocol)

ProtocolFromNetwork returns the protocol from the given net, as used in the "net" golang stdlib.

Types

type IPScope added in v0.6.7

type IPScope int8

IPScope is the scope of the IP address.

const (
	Invalid IPScope = iota - 1
	Undefined
	HostLocal
	LinkLocal
	SiteLocal
	Global
	LocalMulticast
	GlobalMulticast
)

Defined IP Scopes.

func ClassifyIP

func ClassifyIP(ip net.IP) IPScope

ClassifyIP returns the network scope of the given IP address. Deprecated: Please use the new GetIPScope instead.

func GetIPScope added in v0.6.7

func GetIPScope(ip net.IP) IPScope

GetIPScope returns the network scope of the given IP address.

func (IPScope) IsGlobal added in v0.6.7

func (scope IPScope) IsGlobal() bool

IsGlobal returns true if the scope is global.

func (IPScope) IsLAN added in v0.6.7

func (scope IPScope) IsLAN() bool

IsLAN returns true if the scope is site-local or link-local.

func (IPScope) IsLocalhost added in v0.6.7

func (scope IPScope) IsLocalhost() bool

IsLocalhost returns whether the IP refers to the host itself.

type SimpleStreamAssembler

type SimpleStreamAssembler struct {
	Cumulated    []byte
	CumulatedLen int
	Complete     bool
}

SimpleStreamAssembler is a simple assembler for github.com/google/gopacket/tcpassembly.

func NewSimpleStreamAssembler

func NewSimpleStreamAssembler() *SimpleStreamAssembler

NewSimpleStreamAssembler returns a new SimpleStreamAssembler.

func (*SimpleStreamAssembler) Reassembled

func (a *SimpleStreamAssembler) Reassembled(reassembly []tcpassembly.Reassembly)

Reassembled implements tcpassembly.Stream's Reassembled function.

func (*SimpleStreamAssembler) ReassemblyComplete

func (a *SimpleStreamAssembler) ReassemblyComplete()

ReassemblyComplete implements tcpassembly.Stream's ReassemblyComplete function.

type SimpleStreamAssemblerManager

type SimpleStreamAssemblerManager struct {
	InitLock sync.Mutex
	// contains filtered or unexported fields
}

SimpleStreamAssemblerManager is a simple manager for github.com/google/gopacket/tcpassembly.

func (*SimpleStreamAssemblerManager) GetLastAssembler

func (m *SimpleStreamAssemblerManager) GetLastAssembler() *SimpleStreamAssembler

GetLastAssembler returns the newest created stream assembler.

func (*SimpleStreamAssemblerManager) New

New returns a new stream assembler.

Jump to

Keyboard shortcuts

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