netUtil

package
v0.0.0-...-7b93b34 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package netUtil contains all the publicly exposed networking functionality of gort like the port scanning types and functionality provided in 'netUtil.pScan'.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Port

type Port struct {
	// PortNo is the number of the target port.
	// A port number is a 16-bit unsigned integer and thus can range from 0 to 65535.
	PortNo uint16

	// Protocol is the transport protocol of the port (either TCP or UDP).
	Protocol string

	// Service is the default service running on a given port as specified by IANA.
	Service string

	// Description is a short description of the Service.
	Description string
}

Port represents a single target port.

func NewPort

func NewPort(portNo uint16, proto string, service string, desc string) *Port

NewPort returns a pointer to a new instance of Port. portNo is the port number of the new Port and proto is the transport protocol used by it. service is the default service running on a given port as specified by IANA and desc is a short description of that service. To initialize a new port you usually should use ParsePortString as this method will try to lookup the service and description of the given ports automatically.

func (*Port) String

func (p *Port) String() string

String returns a string representation of the Port pointer.

type Ports

type Ports []*Port

Ports is a list of Port pointers.

func ParsePortString

func ParsePortString(ports string, proto string, dataFolder string) Ports

ParsePortString parses ports and returns the newly initialized Ports.

ports is comma separated list of values that can be in either of the following formats: - A single port: 23 - A range of ports: 23-100

The parameter proto specifies the transport protocol of the given ports and dataFolder is the path to the folder which contains the 'service-names-port-numbers.xml' file by IANA that is used for port service lookups. (The file can be found under https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml).

func (Ports) Preview

func (ps Ports) Preview(maxToDisplay int) string

Preview returns a preview string representation of Ports where maxToDisplay is the maximum number of ports that should be shown.

func (Ports) String

func (ps Ports) String() string

String returns a string representation of Ports.

Directories

Path Synopsis
Package macLookup provides a wrapper around the vendor lookup API of 'https://macvendors.co'
Package macLookup provides a wrapper around the vendor lookup API of 'https://macvendors.co'
Package pScan provides all the port scanning capability and the Target and Targets type on which those scans can be performed.
Package pScan provides all the port scanning capability and the Target and Targets type on which those scans can be performed.

Jump to

Keyboard shortcuts

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