epp_client/lib.rs
1//! # EPP (Extensible Provisioning Protocol) Client Library for Domain Registration and Management.
2//!
3//! ## Description
4//!
5//! epp-client is a client library for Internet domain registration and management for domain
6//! registrars ([RFC 5730](https://tools.ietf.org/html/rfc5730)). It supports the following basic
7//! management requests.
8//!
9//! Typically, you will start by initializing an [`EppClient`] instance, which will connect to the EPP server.
10//! From there, you can submit requests using [`EppClient::transact()`].
11//!
12//! ## Core requests
13//!
14//! - [`message::MessagePoll`]
15//! - [`message::MessageAck`]
16//!
17//! ## Domains
18//!
19//! Specified in [RFC 5731](https://tools.ietf.org/html/rfc5731).
20//!
21//! - [`domain::DomainCheck`]
22//! - [`domain::DomainCreate`]
23//! - [`domain::DomainInfo`]
24//! - [`domain::DomainUpdate`]
25//! - [`domain::DomainRenew`]
26//! - [`domain::DomainTransfer`]
27//! - [`domain::DomainDelete`]
28//!
29//! ## Contacts
30//!
31//! Specified in [RFC 5732](https://tools.ietf.org/html/rfc5732).
32//!
33//! - [`contact::ContactCheck`]
34//! - [`contact::ContactCreate`]
35//! - [`contact::ContactInfo`]
36//! - [`contact::ContactUpdate`]
37//! - [`contact::ContactDelete`]
38//!
39//! ## Hosts
40//!
41//! Specified in [RFC 5733](https://tools.ietf.org/html/rfc5733).
42//!
43//! - [`host::HostCheck`]
44//! - [`host::HostCreate`]
45//! - [`host::HostInfo`]
46//! - [`host::HostUpdate`]
47//! - [`host::HostDelete`]
48//!
49//! ## Extensions
50//!
51//! - [`extensions::rgp::report::RgpRestoreReport`]
52//! - [`extensions::rgp::request::RgpRestoreRequest`]
53//! - [`extensions::namestore::NameStore`]
54//! - [`extensions::consolidate::Update`]
55//!
56//! ## Operation
57//!
58//! ```no_run
59//! use std::net::ToSocketAddrs;
60//! use std::time::Duration;
61//!
62//! use epp_client::EppClient;
63//! use epp_client::domain::DomainCheck;
64//! use epp_client::login::Login;
65//!
66//! #[tokio::main]
67//! async fn main() {
68//! // Create an instance of EppClient
69//! let timeout = Duration::from_secs(5);
70//! let mut client = match EppClient::connect("registry_name".to_string(), ("example.com".to_owned(), 7000), None, timeout).await {
71//! Ok(client) => client,
72//! Err(e) => panic!("Failed to create EppClient: {}", e)
73//! };
74//!
75//! let login = Login::new("username", "password", None, None);
76//! client.transact(&login, "transaction-id").await.unwrap();
77//!
78//! // Execute an EPP Command against the registry with distinct request and response objects
79//! let domain_check = DomainCheck { domains: &["eppdev.com", "eppdev.net"] };
80//! let response = client.transact(&domain_check, "transaction-id").await.unwrap();
81//!
82//! response.res_data.unwrap().list
83//! .iter()
84//! .for_each(|chk| println!("Domain: {}, Available: {}", chk.id, chk.available));
85//! }
86//! ```
87//!
88//! The output would look similar to the following
89//!
90//! ```text
91//! Domain: eppdev.com, Available: 1
92//! Domain: eppdev.net, Available: 1
93//! ```
94
95pub mod client;
96pub mod common;
97pub mod connection;
98pub mod contact;
99pub mod domain;
100mod error;
101pub mod hello;
102pub mod login;
103pub mod logout;
104pub mod request;
105pub mod response;
106pub mod xml;
107
108pub mod extensions {
109 pub mod consolidate;
110 pub mod low_balance;
111 pub mod namestore;
112 pub mod rgp;
113}
114
115pub mod host {
116 pub mod check;
117 pub use check::HostCheck;
118
119 pub mod create;
120 pub use create::HostCreate;
121
122 pub mod delete;
123 pub use delete::HostDelete;
124
125 pub mod info;
126 pub use info::HostInfo;
127
128 pub mod update;
129 pub use update::HostUpdate;
130
131 pub const XMLNS: &str = "urn:ietf:params:xml:ns:host-1.0";
132}
133
134pub mod message {
135 pub mod ack;
136 pub use ack::MessageAck;
137
138 pub mod poll;
139 pub use poll::MessagePoll;
140}
141
142pub use client::EppClient;
143pub use error::Error;
144
145#[cfg(test)]
146pub mod tests;