Skip to main content

Zone

Struct Zone 

Source
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: String

Implementations§

Source§

impl Zone

Source

pub fn new(pds_host: &str) -> Result<Self, DidError>

A zone that is the PDS’s own hostname: agents become its immediate subdomains.

Source

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.

Source

pub fn host(&self) -> &str

The base hostname agents are minted under.

Source

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.

Source

pub fn pds_host(&self) -> &str

The hostname of the PDS this zone is delegated from.

Source

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§

Source§

impl Clone for Zone

Source§

fn clone(&self) -> Zone

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Zone

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Zone

Source§

fn eq(&self, other: &Zone) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Zone

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.