Documentation
¶
Overview ¶
Package netports Well known ports parsed from https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
func FilterByCategory ¶
func FilterByCategory(categories ...PortCategory) Filter
func FilterByProto ¶
type Port ¶
type Port struct {
// Start
// Port number range start and end. Single port is represented as [port, port], i.e. {22, 22}
// multiple ports are represented as [min, max] included, i.e. {2001, 2009}
Start uint16 `json:"start"`
End uint16 `json:"end"`
Category PortCategory `json:"category"`
Description string `json:"description"`
Types map[PortProto]RegistrationStatus `json:"types"`
}
type PortCategory ¶
type PortCategory string
const ( // CategoryWellKnown (0-1024). CategoryWellKnown PortCategory = "WellKnown" // CategoryRegistered (1024-49151). CategoryRegistered PortCategory = "Registered" // CategoryOther (49152-65535). CategoryOther PortCategory = "Other" )
type Ports ¶
type Ports []Port
Example ¶
fmt.Printf("%d %d",
len(KnownPorts.FilterCollect(
FilterByProto(TCP),
FilterByCategory(CategoryWellKnown, CategoryRegistered),
)),
len(KnownPorts.FilterCollect(
FilterByProto(UDP),
FilterByCategory(CategoryWellKnown, CategoryRegistered),
)),
)
Output: 2853 2448
var KnownPorts Ports
KnownPorts List of known ports from https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
func (Ports) FilterCollect ¶
func (Ports) GroupByNumber ¶
type RegistrationStatus ¶
type RegistrationStatus string
const ( // RegistrationYes // Described protocol is assigned by IANA for this port, and is: standardized, specified, or widely used for such. RegistrationYes RegistrationStatus = "Yes" // RegistrationUnofficial // Described protocol is not assigned by IANA for this port, but is: standardized, specified, or widely used for such. RegistrationUnofficial RegistrationStatus = "Unofficial" // RegistrationAssigned // Described protocol is assigned by IANA for this port, but is not: standardized, specified, or widely used for such. RegistrationAssigned RegistrationStatus = "Assigned" // RegistrationNo // Described protocol is not assigned by IANA for this port, standardized, specified, or widely used for such. RegistrationNo RegistrationStatus = "No" // RegistrationReserved // Port is reserved by IANA, generally to prevent collision having its previous use removed. // The port number may be available for assignment upon request to IANA. RegistrationReserved RegistrationStatus = "Reserved" )
Click to show internal directories.
Click to hide internal directories.