Update README
This commit is contained in:
parent
4c944dfa98
commit
9061097641
98
README.md
98
README.md
|
@ -5,10 +5,12 @@
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
epp-client is a client library written in Rust for Internet domain registration and management for domain registrars.
|
epp-client is a client library written in Rust for Internet domain registration
|
||||||
|
and management for domain registrars.
|
||||||
|
|
||||||
It supports the following basic Domain, Contact, Host, and Message management calls, with plans to add more calls
|
It supports the following basic Domain, Contact, Host, and Message management
|
||||||
and other EPP extensions in the future, and to eventually be RFC compliant with the EPP protocol.
|
calls, with plans to add more calls and other EPP extensions in the future, and
|
||||||
|
to eventually be RFC compliant with the EPP protocol.
|
||||||
|
|
||||||
- Domain Check
|
- Domain Check
|
||||||
- Domain Create
|
- Domain Create
|
||||||
|
@ -44,45 +46,38 @@ Just add the following to your project's `Cargo.toml`
|
||||||
epp-client = "0.2"
|
epp-client = "0.2"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
To use the library, you must have an `epp-client/epp-client.toml` config file with the relevant registry
|
|
||||||
credentials in your default user configuration directory on your OS. For Linux, this is the `XDG user directory`,
|
|
||||||
usually located at `$HOME/.config` or defined by the `XDG_CONFIG_HOME` environment variable.
|
|
||||||
|
|
||||||
An example config looks like this:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[registry.verisign]
|
|
||||||
host = 'epp.verisign-grs.com'
|
|
||||||
port = 700
|
|
||||||
username = 'username'
|
|
||||||
password = 'password'
|
|
||||||
# service extensions
|
|
||||||
ext_uris = []
|
|
||||||
|
|
||||||
[registry.verisign.tls_files]
|
|
||||||
# the full client certificate chain in PEM format
|
|
||||||
cert_chain = '/path/to/certificate/chain/pemfile'
|
|
||||||
# the RSA private key for your certificate
|
|
||||||
key = '/path/to/private/key/pemfile'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Operation
|
## Operation
|
||||||
|
|
||||||
Once the config is set correctly, you can create a mut variable of type `EppClient`
|
You can create a mut variable of type `EppClient` with the domain registry config.
|
||||||
with the domain registry
|
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
use epp_client::config::{EppClientConfig, EppClientConnection};
|
||||||
use epp_client::EppClient;
|
use epp_client::EppClient;
|
||||||
use epp_client::epp::{EppDomainCheck, EppDomainCheckResponse};
|
use epp_client::epp::{EppDomainCheck, EppDomainCheckResponse};
|
||||||
use epp_client::epp::generate_client_tr_id;
|
use epp_client::epp::generate_client_tr_id;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
// Create an instance of EppClient, specifying the name of the registry as in
|
// Configure the client to connect to one of more registries
|
||||||
// the config file
|
let mut registry: HashMap<String, EppClientConnection> = HashMap::new();
|
||||||
let mut client = match EppClient::new("verisign").await {
|
registry.insert(
|
||||||
|
"registry_name".to_owned(),
|
||||||
|
EppClientConnection {
|
||||||
|
host: "example.com".to_owned(),
|
||||||
|
port: 700,
|
||||||
|
username: "username".to_owned(),
|
||||||
|
password: "password".to_owned(),
|
||||||
|
ext_uris: None,
|
||||||
|
tls_files: None,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
let config = EppClientConfig { registry };
|
||||||
|
|
||||||
|
// Create an instance of EppClient, passing the config and the
|
||||||
|
// registry you want to connect to
|
||||||
|
let mut client = match EppClient::new(&config, "registry_name").await {
|
||||||
Ok(client) => client,
|
Ok(client) => client,
|
||||||
Err(e) => panic!("Failed to create EppClient: {}", e)
|
Err(e) => panic!("Failed to create EppClient: {}", e)
|
||||||
};
|
};
|
||||||
|
@ -103,13 +98,48 @@ async fn main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The output would look similar to the following
|
The output would look similar to the following:
|
||||||
|
|
||||||
```
|
```
|
||||||
Domain: eppdev.com, Available: 1
|
Domain: eppdev.com, Available: 1
|
||||||
Domain: eppdev.net, Available: 1
|
Domain: eppdev.net, Available: 1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You may also choose to store your configuration in something like a toml file:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[registry.verisign]
|
||||||
|
host = 'epp.verisign-grs.com'
|
||||||
|
port = 700
|
||||||
|
username = 'username'
|
||||||
|
password = 'password'
|
||||||
|
# service extensions
|
||||||
|
ext_uris = []
|
||||||
|
|
||||||
|
[registry.verisign.tls_files]
|
||||||
|
# the full client certificate chain in PEM format
|
||||||
|
cert_chain = '/path/to/certificate/chain/pemfile'
|
||||||
|
# the RSA private key for your certificate
|
||||||
|
key = '/path/to/private/key/pemfile'
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
```rust
|
||||||
|
use epp_client::config::{EppClientConfig};
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
// parse EppClientConfig from toml file
|
||||||
|
let config_path = Path::new("../secrets/epp-client.toml");
|
||||||
|
let config: EppClientConfig =
|
||||||
|
toml::from_str(&fs::read_to_string(config_path).await.unwrap()).unwrap();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Request
|
## Request
|
||||||
|
|
||||||
Currently I don't have access to a registry's OT&E account to do extensive testing. I am using [hexonet's EPP Gateway](https://wiki.hexonet.net/wiki/EPP_Gateway) for testing, but access to a registry's OT&E account would be very helpful, so if anyone could help me out with one I would be very grateful!
|
Currently I don't have access to a registry's OT&E account to do extensive
|
||||||
|
testing. I am using
|
||||||
|
[hexonet's EPP Gateway](https://wiki.hexonet.net/wiki/EPP_Gateway) for testing,
|
||||||
|
but access to a registry's OT&E account would be very helpful, so if anyone
|
||||||
|
could help me out with one I would be very grateful!
|
||||||
|
|
Loading…
Reference in New Issue