Documentation
¶
Index ¶
- Variables
- func GenerateKey() ([]byte, string, error)
- func HostFromKey(pemPath string) (string, error)
- func ResolveName(configured string, domain string, host string) string
- func ValidateInfoConfig(info stconf.InfoObj) error
- func WriteKeyFile(filePath string, pemBytes []byte) error
- type NodeInterface
- type Obj
- func (obj *Obj) Address() net.IP
- func (obj *Obj) Close(ctx context.Context) error
- func (obj *Obj) DialContext(ctx context.Context, network, address string) (net.Conn, error)
- func (obj *Obj) Enabled() bool
- func (obj *Obj) Host() string
- func (obj *Obj) ListenerFor(transport TransportType) (net.Listener, error)
- func (obj *Obj) OwnsHost(host string) bool
- type TransportType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDisabled means a ygg operation was requested with empty yggdrasil.pem_key. ErrDisabled = errors.New("yggdrasil mesh is disabled (yggdrasil.pem_key is empty)") )
Functions ¶
func GenerateKey ¶
GenerateKey creates a random node private key and returns its PKCS#8 PEM plus ygg host. One random ed25519 key is already unique enough; the full node identity keeps the whole key through host and certificate.
func HostFromKey ¶
HostFromKey derives the ygg host directly from a PEM key without starting a node. Rebuild-cache/self-test uses it to rebuild host-sensitive artifacts under the same entry host as serving, without network boot.
func ResolveName ¶
ResolveName returns final info.Name: configured value, normalized domain or ygg host, then stable target.Name fallback. The result is always valid for the info sigil.
func ValidateInfoConfig ¶
ValidateInfoConfig checks the identity card by ratatoskr info-sigil rules, including field and value limits. Empty Name is allowed because runtime supplies a default.
func WriteKeyFile ¶
WriteKeyFile writes a private key PEM with secret permissions: 0o600, explicit Chmod, and O_NOFOLLOW. The caller decides whether the file may already exist or be overwritten.
Types ¶
type NodeInterface ¶
type NodeInterface interface {
DialContext(ctx context.Context, network, address string) (net.Conn, error)
ListenerFor(transport TransportType) (net.Listener, error)
Host() string
Address() net.IP
OwnsHost(host string) bool
Enabled() bool
Close(ctx context.Context) error
}
NodeInterface is the ygg node transport boundary and the only contract for source/server.
type Obj ¶
type Obj struct {
// contains filtered or unexported fields
}
Obj owns the node. In disabled mode node==nil and enabled==false.
func New ¶
New starts a node when pem_key is set and returns a disabled Obj when it is empty. With a logger, ratatoskr events go through the shared pipeline; otherwise library noise is discarded.
func (*Obj) DialContext ¶
DialContext resolves host (<hex>.pk.ygg or IPv6 literal) into a 200::/7 transport address and opens a connection through the node netstack. It can be used as http.Transport.DialContext and net/rpc dialer.
func (*Obj) ListenerFor ¶
func (obj *Obj) ListenerFor(transport TransportType) (net.Listener, error)
ListenerFor returns the ygg-entry listener on the node address, port 80.
type TransportType ¶
type TransportType uint8
TransportType identifies which listener mod/server requests.
const ( // TransportYgg is the ygg-entry listener, the only mesh transport. TransportYgg TransportType = iota + 1 )