Skip to main content

serving API

SDK 0.4.0. This reference describes the supported authoring interface.

bind_hosts​

The addresses a child's server listens on: loopback, then the serve address.

Bind each one separately. Binding every interface would also accept the local network, which the host did not choose to serve.

def bind_hosts(startup: Startup) -> tuple[str, ...]:
...

advertised_host​

The host part of the URL a child publishes: the serve address, else loopback.

An IPv6 serve address comes back in brackets, ready to go into a URL.

def advertised_host(startup: Startup) -> str:
...

peer_allowed​

Whether a connection from address may be served.

Loopback callers are on the node. Tailscale callers reached the node through its tailnet. Every other caller is refused, including the local network, as is anything that is not an IP address. An IPv4 caller seen through an IPv6 socket (::ffff:100.64.0.1) is judged by its IPv4 address, and an IPv6 zone suffix (%en0) is ignored.

def peer_allowed(address: str) -> bool:
...