Documentation
¶
Overview ¶
Package ietf is the library behind the ietf command line: the HTTP client, request shaping, and the typed data models for the IETF Datatracker API (RFC documents and working groups).
The Client here is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public site throws under load.
Index ¶
- Constants
- type Client
- func (c *Client) Get(ctx context.Context, rawURL string) ([]byte, error)
- func (c *Client) GetRFC(ctx context.Context, number string) (*RFC, error)
- func (c *Client) ListWGs(ctx context.Context, state string, limit int) ([]WorkingGroup, error)
- func (c *Client) SearchRFCs(ctx context.Context, query string, limit int) ([]RFC, error)
- type Config
- type Domain
- type RFC
- type WorkingGroup
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const DefaultUserAgent = "ietf-cli/dev (+https://github.com/tamnd/ietf-cli)"
DefaultUserAgent identifies the client to the IETF Datatracker. A real, honest User-Agent is both polite and the thing most likely to keep you unblocked.
const Host = "datatracker.ietf.org"
Host is the site this client talks to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
BaseURL string
// Rate is the minimum gap between requests. Zero means no pacing.
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to the IETF Datatracker over HTTP.
func (*Client) Get ¶
Get fetches url and returns the response body. It paces and retries according to the client's settings.
func (*Client) GetRFC ¶
GetRFC fetches one RFC by number. The number may be "2616" or "rfc2616"; both are accepted.
type Config ¶
Config holds tunable client parameters so callers and the kit factory share one place to adjust them.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns production-safe defaults: 100 ms pacing, 3 retries, 15 s timeout.
type Domain ¶
type Domain struct{}
Domain is the IETF Datatracker driver.
func (Domain) Classify ¶
Classify turns any accepted input into the canonical (type, id). Inputs starting with "rfc" or all-digits → ("rfc", normalised name). Anything else → ("query", input).
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type RFC ¶
type RFC struct {
Name string `kit:"id" json:"name"`
Title string `json:"title"`
Pages int `json:"pages"`
Abstract string `json:"abstract"`
StdLevel string `json:"std_level"` // e.g. "ps", "ds", "std", "bcp", "info", "exp", "hist"
Updated string `json:"updated"`
}
RFC is a single IETF RFC document.