Skip to content

Commit

Permalink
get all Server public interfaces documented
Browse files Browse the repository at this point in the history
  • Loading branch information
bluejekyll committed Apr 14, 2017
1 parent 54046c3 commit 211bd48
Show file tree
Hide file tree
Showing 29 changed files with 393 additions and 267 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,9 +5,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## 0.10.1 (unreleased)
### Added
- Added `From<IpAddr>` for Name (reverse DNS) #105
- AppVeyor support #103

### Changed
- Fixed TLS documentation, and add more elsewhere; fixes #102
- Upgraded tokio-core and moved to tokio-io
- *Important* Some `Server` types have been migrated to [RFC#344](https://github.com/aturon/rfcs/blob/conventions-galore/active/0000-conventions-galore.md#gettersetter-apis) style. `get_field()` -> `field()`; `field()` -> `set_field()`

## 0.10.0
### Changed
Expand Down
1 change: 1 addition & 0 deletions README.md
@@ -1,4 +1,5 @@
[![Build Status](https://travis-ci.org/bluejekyll/trust-dns.svg?branch=master)](https://travis-ci.org/bluejekyll/trust-dns)
[![Build status](https://ci.appveyor.com/api/projects/status/tmlih8wdt7628vyl/branch/master?svg=true)](https://ci.appveyor.com/project/bluejekyll/trust-dns/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/bluejekyll/trust-dns/badge.svg?branch=master)](https://coveralls.io/github/bluejekyll/trust-dns?branch=master)
[![](http://meritbadge.herokuapp.com/trust-dns)](https://crates.io/crates/trust-dns)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE-MIT)
Expand Down
1 change: 1 addition & 0 deletions client/src/op/message.rs
Expand Up @@ -666,6 +666,7 @@ impl Message {
Ok(())
}

/// Always returns an error; enable OpenSSL for signing support
#[cfg(not(feature = "openssl"))]
pub fn sign(&mut self, _: &Signer, _: u32) -> DnsSecResult<()> {
Err(DnsSecErrorKind::Message("openssl feature not enabled").into())
Expand Down
1 change: 1 addition & 0 deletions client/src/rr/dnssec/signer.rs
Expand Up @@ -239,6 +239,7 @@ pub struct Signer {
is_zone_update_auth: bool,
}

/// Placeholder type for when OpenSSL and *ring* are disabled; enable OpenSSL and Ring for support
#[cfg(not(any(feature = "openssl", feature = "ring")))]
pub struct Signer;

Expand Down
2 changes: 2 additions & 0 deletions native-tls/src/lib.rs
Expand Up @@ -16,6 +16,8 @@

//! TLS protocol related components for DNS over TLS

#![deny(missing_docs)]

extern crate futures;
extern crate native_tls;
extern crate tokio_core;
Expand Down
8 changes: 7 additions & 1 deletion native-tls/src/tls_client_connection.rs
Expand Up @@ -37,6 +37,7 @@ pub struct TlsClientConnection {
}

impl TlsClientConnection {
/// Creates a new builder for the construction of a TlsClientConnection.
pub fn builder() -> TlsClientConnectionBuilder {
TlsClientConnectionBuilder(TlsClientStreamBuilder::new())
}
Expand All @@ -45,11 +46,16 @@ impl TlsClientConnection {
impl ClientConnection for TlsClientConnection {
type MessageStream = TlsClientStream;

fn unwrap(self) -> (Core, Box<Future<Item=Self::MessageStream, Error=io::Error>>, Box<ClientStreamHandle>){
fn unwrap
(self)
-> (Core,
Box<Future<Item = Self::MessageStream, Error = io::Error>>,
Box<ClientStreamHandle>) {
(self.io_loop, self.tls_client_stream, self.client_stream_handle)
}
}

/// A builder for the TlsClientStream.
pub struct TlsClientConnectionBuilder(TlsClientStreamBuilder);

impl TlsClientConnectionBuilder {
Expand Down
7 changes: 7 additions & 0 deletions native-tls/src/tls_client_stream.rs
Expand Up @@ -5,6 +5,8 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

//! TlsClientStream for DNS over TLS

use std::net::SocketAddr;
use std::io;

Expand All @@ -22,11 +24,16 @@ use trust_dns::client::ClientStreamHandle;

use TlsStreamBuilder;

/// TlsClientStream secure DNS over TCP stream
///
/// See TlsClientStreamBuilder::new()
pub type TlsClientStream = TcpClientStream<TokioTlsStream<TokioTcpStream>>;

/// Builder for TlsClientStream
pub struct TlsClientStreamBuilder(TlsStreamBuilder);

impl TlsClientStreamBuilder {
/// Creates a builder fo the construction of a TlsClientStream
pub fn new() -> TlsClientStreamBuilder {
TlsClientStreamBuilder(TlsStreamBuilder::new())
}
Expand Down
4 changes: 4 additions & 0 deletions native-tls/src/tls_stream.rs
Expand Up @@ -5,6 +5,8 @@
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

//! Base TlsStream

use std::net::SocketAddr;
use std::io;

Expand All @@ -19,6 +21,7 @@ use tokio_tls::{TlsConnectorExt, TlsStream as TokioTlsStream};
use trust_dns::BufStreamHandle;
use trust_dns::tcp::TcpStream;

/// A TlsStream counterpart to the TcpStream which embeds a secure TlsStream
pub type TlsStream = TcpStream<TokioTlsStream<TokioTcpStream>>;

fn tls_new(certs: Vec<Certificate>, pkcs12: Option<Pkcs12>) -> io::Result<TlsConnector> {
Expand Down Expand Up @@ -71,6 +74,7 @@ pub fn tls_from_stream(stream: TokioTlsStream<TokioTcpStream>,
(stream, message_sender)
}

/// A builder for the TlsStream
pub struct TlsStreamBuilder {
ca_chain: Vec<Certificate>,
identity: Option<Pkcs12>,
Expand Down
1 change: 1 addition & 0 deletions server/build.rs
Expand Up @@ -26,6 +26,7 @@ fn main() {
let mut f = File::create(&dest_path).unwrap();


f.write_all(b"/// Returns the current version of TRust-DNS\n").unwrap();
f.write_all(b"pub fn version() -> &'static str {").unwrap();
write!(f, " \"{}\" ", version).unwrap();
f.write_all(b" }").unwrap();
Expand Down

0 comments on commit 211bd48

Please sign in to comment.