pub struct Zone {
pds_host: String,
host: String,
}Expand description
The DNS zone agents are minted under, plus the port their PDS listens on during development.
A zone exists because atproto supports “only hostname-level did:web
DIDs: path-based DIDs are not supported”. Every agent therefore needs its
own hostname, not its own path under a shared one, so the deployment has
to own a name it can put arbitrary subdomains under.
A zone is constructed against the hostname of the PDS that will serve the
accounts, but it does not have to sit at or below that hostname: a PDS at
pds.example.com may delegate pds.example.com, agents.pds.example.com,
or agents.anotherexample.com, provided it holds DNS credentials for
whichever zone it names. Which server serves a given agent is answered by
resolving the agent’s DID document, which carries the PDS’s
serviceEndpoint under #atproto_pds — not by inspecting the DID string.
Fields§
§pds_host: String§host: StringImplementations§
Source§impl Zone
impl Zone
Sourcepub fn new(pds_host: &str) -> Result<Self, DidError>
pub fn new(pds_host: &str) -> Result<Self, DidError>
A zone that is the PDS’s own hostname: agents become its immediate subdomains.
Sourcepub fn delegated(pds_host: &str, zone_host: &str) -> Result<Self, DidError>
pub fn delegated(pds_host: &str, zone_host: &str) -> Result<Self, DidError>
A zone the PDS delegates agent names from. It may be any hostname the
PDS holds DNS credentials for, including one that does not sit under
pds_host at all.
Sourcepub fn is_loopback(&self) -> bool
pub fn is_loopback(&self) -> bool
Whether this zone is localhost or under it, and so development-only.
RFC 6761 reserves that subtree for loopback, so every agent hostname minted here resolves without a zone to write, has no operator’s repository to read and is reachable by no relay. The server picks its listener, its certificate source and what it polls for by this.
Sourcepub fn service_did(&self) -> String
pub fn service_did(&self) -> String
The did:web naming the server itself, rather than any account on it.
This is the DID a human’s vouch record points at when it says “this is
my personal data server and I take responsibility for the agents on
it”. It is the zone hostname and not the PDS hostname: a
ZoneRegistry holds one Zone per zone a deployment mints under,
and the vouch has to name the zone whose accounts it is vouching for
— naming the PDS hostname instead would not say which of a
deployment’s several zones is covered.
Returned as a string. It is a did:web for a service, not for an
account, and handing back an AccountDid would say otherwise.
Trait Implementations§
impl Eq for Zone
impl StructuralPartialEq for Zone
Auto Trait Implementations§
impl Freeze for Zone
impl RefUnwindSafe for Zone
impl Send for Zone
impl Sync for Zone
impl Unpin for Zone
impl UnsafeUnpin for Zone
impl UnwindSafe for Zone
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.