inspect

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 16 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 NetSocketsJSON added in v0.5.0

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

NetSocketsJSON returns JSON-encoded output for the socket list.

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 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(procRoot string, opts NetFilterOptions) ([]SocketEntry, error)

ListSockets scans /proc for socket information and returns filtered entries. procRoot allows tests to supply a fake /proc tree (default: "/proc").

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