inspect

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertInfoJSON

func CertInfoJSON(info *CertInfo) ([]byte, error)

func DNSResultJSON added in v0.5.0

func DNSResultJSON(result *DNSResult) ([]byte, error)

DNSResultJSON returns JSON-encoded output.

func DomainInfoJSON added in v0.6.0

func DomainInfoJSON(info *DomainInfo) ([]byte, error)

DomainInfoJSON returns JSON-encoded output.

func LookupPublicIP added in v0.6.0

func LookupPublicIP() (string, error)

LookupPublicIP returns the public IP address.

func NetSocketsJSON added in v0.5.0

func NetSocketsJSON(entries []SocketEntry) ([]byte, error)

NetSocketsJSON returns JSON-encoded output for the socket list.

func SortSocketEntries added in v0.7.1

func SortSocketEntries(entries []SocketEntry)

SortSocketEntries sorts entries by protocol then local port.

func SubnetInfoJSON added in v0.6.0

func SubnetInfoJSON(info *SubnetInfo) ([]byte, error)

SubnetInfoJSON returns JSON-encoded output.

func URLInfoJSON

func URLInfoJSON(info *URLInfo) ([]byte, error)

URLInfoJSON returns the URL info as formatted JSON.

func URLInfoTable

func URLInfoTable(info *URLInfo) string

URLInfoTable returns a formatted table-style string.

Types

type CertInfo

type CertInfo struct {
	Subject            string    `json:"subject"`
	Issuer             string    `json:"issuer"`
	NotBefore          time.Time `json:"not_before"`
	NotAfter           time.Time `json:"not_after"`
	SerialNumber       string    `json:"serial_number"`
	SignatureAlgorithm string    `json:"signature_algorithm"`
	DNSNames           []string  `json:"dns_names,omitempty"`
	IsExpired          bool      `json:"is_expired"`
}

CertInfo holds decoded X.509 certificate information.

func CertDecode

func CertDecode(input []byte) (*CertInfo, error)

type DNSRecord added in v0.5.0

type DNSRecord struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

DNSRecord represents a single DNS record.

type DNSResult added in v0.5.0

type DNSResult struct {
	Name    string      `json:"name"`
	Records []DNSRecord `json:"records"`
}

DNSResult holds all DNS records for a query.

func LookupDNS added in v0.5.0

func LookupDNS(name string, recordType string) (*DNSResult, error)

LookupDNS performs DNS lookups for the given name and optional record type.

type DomainInfo added in v0.6.0

type DomainInfo struct {
	Domain      string   `json:"domain"`
	Registrar   string   `json:"registrar,omitempty"`
	Created     string   `json:"created,omitempty"`
	Expires     string   `json:"expires,omitempty"`
	Updated     string   `json:"updated,omitempty"`
	Status      []string `json:"status,omitempty"`
	Nameservers []string `json:"nameservers,omitempty"`
	A           []string `json:"a,omitempty"`
	AAAA        []string `json:"aaaa,omitempty"`
	CNAME       string   `json:"cname,omitempty"`
	TXT         []string `json:"txt,omitempty"`
}

DomainInfo holds parsed RDAP and DNS information for a domain.

func LookupDomain added in v0.6.0

func LookupDomain(name string) (*DomainInfo, error)

LookupDomain queries RDAP and DNS for domain information.

type NetFilterOptions added in v0.5.0

type NetFilterOptions struct {
	All  bool
	TCP  bool
	UDP  bool
	Port int
}

NetFilterOptions controls which sockets are returned.

type SocketEntry added in v0.5.0

type SocketEntry struct {
	Proto      string `json:"proto"`
	LocalIP    string `json:"local_ip"`
	LocalPort  uint16 `json:"local_port"`
	RemoteIP   string `json:"remote_ip"`
	RemotePort uint16 `json:"remote_port"`
	State      string `json:"state"`
	PID        int    `json:"pid"`
	Process    string `json:"process"`
	User       string `json:"user"`
	Service    string `json:"service,omitempty"`
	Container  string `json:"container,omitempty"`
}

SocketEntry represents a single network socket with process info.

func ListSockets added in v0.5.0

func ListSockets(opts NetFilterOptions) ([]SocketEntry, error)

ListSockets scans /proc for socket information and returns filtered entries.

type SubnetInfo added in v0.6.0

type SubnetInfo struct {
	Network   string `json:"network"`
	Netmask   string `json:"netmask"`
	Broadcast string `json:"broadcast"`
	First     string `json:"first"`
	Last      string `json:"last"`
	Hosts     uint32 `json:"hosts"`
}

SubnetInfo holds parsed CIDR subnet information.

func ParseSubnet added in v0.6.0

func ParseSubnet(cidr string) (*SubnetInfo, error)

ParseSubnet parses a CIDR string and returns subnet information.

type URLInfo

type URLInfo struct {
	Scheme   string              `json:"scheme"`
	Host     string              `json:"host"`
	Port     string              `json:"port,omitempty"`
	Path     string              `json:"path,omitempty"`
	Query    map[string][]string `json:"query,omitempty"`
	Fragment string              `json:"fragment,omitempty"`
	User     string              `json:"user,omitempty"`
}

URLInfo holds parsed URL components.

func ParseURL

func ParseURL(input string) (*URLInfo, error)

ParseURL parses a URL string into its components.

Jump to

Keyboard shortcuts

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