package netdb
Import Path
modernc.org/libc/honnef.co/go/netdb (on go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Involved Source Files
Package netdb provides a Go interface for the protoent and servent
structures as defined in netdb.h
A pure Go implementation is used by parsing /etc/protocols and
/etc/services
All return values are pointers that point to the entries in the
original list of protocols and services. Manipulating the entries
would affect the entire program.
Package-Level Type Names (total 2, both are exported)
Aliases []string
Name string
Number int
Equal checks if two Protoents are the same, which is the case if
their protocol numbers are identical or when both Protoents are
nil.
func GetProtoByName(name string) (protoent *Protoent)
func GetProtoByNumber(num int) (protoent *Protoent)
func GetServByName(name string, protocol *Protoent) (servent *Servent)
func GetServByPort(port int, protocol *Protoent) *Servent
func (*Protoent).Equal(other *Protoent) bool
Aliases []string
Name string
Port int
Protocol *Protoent
Equal checks if two Servents are the same, which is the case if
their port numbers and protocols are identical or when both
Servents are nil.
func GetServByName(name string, protocol *Protoent) (servent *Servent)
func GetServByPort(port int, protocol *Protoent) *Servent
func (*Servent).Equal(other *Servent) bool
Package-Level Functions (total 5, in which 4 are exported)
GetProtoByName returns the Protoent whose name or any of its
aliases matches the argument.
GetProtoByNumber returns the Protoent for a given protocol number.
GetServByName returns the Servent for a given service name or alias
and protocol. If the protocol is nil, the first service matching
the service name is returned.
GetServByPort returns the Servent for a given port number and
protocol. If the protocol is nil, the first service matching the
port number is returned.
Package-Level Variables (total 2, both are exported)
These variables get populated from /etc/protocols and /etc/services
respectively.
These variables get populated from /etc/protocols and /etc/services
respectively.
Package-Level Constants (total 2, neither is exported)
![]() |
The pages are generated with Golds v0.3.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |