netdb

package
v0.1.8-rc0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceNames

type ServiceNames struct {
	// contains filtered or unexported fields
}

func LoadServicesDB

func LoadServicesDB(protocols, services io.Reader) (*ServiceNames, error)

LoadServicesDB receives readers to the /etc/protocols and /etc/services formatted content and returns a database that allow querying service names from ports and protocol information

func (*ServiceNames) ByPortAndProtocolName

func (db *ServiceNames) ByPortAndProtocolName(port int, nameOrAlias string) string

ByPortAndProtocolName returns the service name given a port and a protocol name (or its alias). If the protocol does not exist, returns the name of any service matching the port number.

func (*ServiceNames) ByPortAndProtocolNumber

func (db *ServiceNames) ByPortAndProtocolNumber(port, protoNum int) string

ByPortAndProtocolNumber returns the service name given a port and a protocol number. If the protocol does not exist, returns the name of any service matching the port number.

Jump to

Keyboard shortcuts

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