networkspec

package
v0.38.6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BaseURL is the ethpandaops devnet spec namespace on
	// notes.ethereum.org. The network id is appended to form the page URL.
	BaseURL = "https://notes.ethereum.org/@ethpandaops/"

	HTTPTimeout = 15 * time.Second

	// MaxBytes caps the markdown download size.
	MaxBytes = 2 << 20 // 2 MiB
)

Variables

View Source
var AllowedHosts = map[string]bool{
	"notes.ethereum.org": true,
	"hackmd.io":          true,
}

AllowedHosts restricts spec fetches to the notes.ethereum.org / HackMD surfaces, both as an SSRF guard on caller-supplied urls and to keep the operation focused on devnet spec documents.

Functions

func Fetch

func Fetch(ctx context.Context, client *http.Client, pageURL string) (string, int, error)

Fetch downloads the raw markdown for a spec page via HackMD's /download endpoint.

func ResolveURL

func ResolveURL(id, override string) (string, error)

ResolveURL builds the spec page URL for a network, honoring an optional caller override. The host must be on the allowlist.

Types

type EIP

type EIP struct {
	ID         string   `json:"id"`
	Title      string   `json:"title,omitempty"`
	Flags      []string `json:"flags,omitempty"`
	SpecRef    string   `json:"spec_ref,omitempty"`
	SpecURL    string   `json:"spec_url,omitempty"`
	URL        string   `json:"url,omitempty"`
	StatusText string   `json:"status_text,omitempty"`
}

type Image

type Image struct {
	Layer   string `json:"layer,omitempty"`
	Client  string `json:"client,omitempty"`
	Image   string `json:"image"`
	Version string `json:"version,omitempty"`
	URL     string `json:"url,omitempty"`
}

type Release

type Release struct {
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
	URL     string `json:"url,omitempty"`
	Status  string `json:"status,omitempty"`
}

type Response

type Response struct {
	Network           string           `json:"network"`
	URL               string           `json:"url"`
	Title             string           `json:"title,omitempty"`
	Notices           []string         `json:"notices,omitempty"`
	EIPs              []EIP            `json:"eips,omitempty"`
	SystemContracts   []SystemContract `json:"system_contracts,omitempty"`
	Releases          []Release        `json:"releases,omitempty"`
	ParticipantImages []Image          `json:"participant_images,omitempty"`
	MetricsURL        string           `json:"metrics_url,omitempty"`
	PreviousSpecURL   string           `json:"previous_spec_url,omitempty"`
}

Response is the compact, LLM-oriented spec digest embedded in networks://{id} resources.

func FetchAndParse

func FetchAndParse(ctx context.Context, client *http.Client, id, override string) (*Response, int, error)

FetchAndParse downloads the conventional or overridden spec page and returns the compact digest. Missing pages are returned as HTTP 404 errors so callers can decide whether that is fatal for their surface.

func Parse

func Parse(id, pageURL, markdown string) Response

Parse digests a spec page into a compact, structured shape for LLM callers.

type Section

type Section struct {
	Heading string `json:"heading"`
	Content string `json:"content,omitempty"`
}

Section is a level-2 (##) section of a spec page. Content is the verbatim markdown under the heading.

type SystemContract

type SystemContract struct {
	Contract    string `json:"contract"`
	Requirement string `json:"requirement,omitempty"`
	Type        string `json:"type,omitempty"`
	Address     string `json:"address"`
}

Jump to

Keyboard shortcuts

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