virtual workspace, edition 2018

This commit is contained in:
Stefan Bühler 2019-07-01 17:43:34 +02:00
parent 0abbb48e1d
commit 174314cbcb
47 changed files with 942 additions and 428 deletions

734
Cargo.lock generated
View File

@ -1,58 +1,117 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "backtrace"
version = "0.3.5"
name = "arrayvec"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "autocfg"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "backtrace"
version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "backtrace-sys"
version = "0.1.16"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "bitflags"
version = "1.0.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.2.1"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "bytes"
version = "0.4.6"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cc"
version = "1.0.4"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.2"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-deque"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-epoch"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-queue"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam-utils"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "data-encoding"
version = "2.1.1"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -60,23 +119,24 @@ name = "dnsbox"
version = "0.1.0"
dependencies = [
"dnsbox-base 0.1.0",
"futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "dnsbox-base"
version = "0.1.0"
dependencies = [
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"data-encoding 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dnsbox-derive 0.1.0",
"failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -89,29 +149,40 @@ dependencies = [
[[package]]
name = "failure"
version = "0.1.1"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"backtrace 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "failure_derive"
version = "0.1.1"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "fnv"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "fuchsia-zircon"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -122,7 +193,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "futures"
version = "0.1.18"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -130,7 +201,7 @@ name = "iovec"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -145,74 +216,132 @@ dependencies = [
[[package]]
name = "lazy_static"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lazycell"
version = "0.6.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.36"
version = "0.2.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "log"
version = "0.3.9"
name = "lock_api"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.4.1"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "memoffset"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "mio"
version = "0.6.13"
version = "0.6.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mio-uds"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "miow"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "net2"
version = "0.2.31"
version = "0.2.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "nodrop"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "num_cpus"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "owning_ref"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot_core"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "proc-macro2"
version = "0.4.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -221,28 +350,171 @@ version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc-demangle"
version = "0.1.5"
name = "quote"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "scoped-tls"
version = "0.1.0"
name = "rand"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "slab"
version = "0.3.0"
name = "rand_chacha"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "slab"
name = "rand_core"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_core"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand_hc"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_isaac"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_jitter"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_os"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_pcg"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand_xorshift"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-demangle"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "scoped-tls"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "scopeguard"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "slab"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "smallvec"
version = "0.4.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "smallvec"
version = "0.6.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "stable_deref_trait"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -255,6 +527,16 @@ dependencies = [
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
version = "0.15.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synom"
version = "0.11.3"
@ -265,36 +547,209 @@ dependencies = [
[[package]]
name = "synstructure"
version = "0.6.1"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-sync 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-trace-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-codec"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-core"
version = "0.1.12"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-current-thread"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-executor"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-fs"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-io"
version = "0.1.5"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-reactor"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-sync 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-sync"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-tcp"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-threadpool"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-timer"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-trace-core"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-udp"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tokio-uds"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -302,6 +757,11 @@ name = "unicode-xid"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.2.8"
@ -309,7 +769,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.3.4"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -341,43 +801,91 @@ dependencies = [
]
[metadata]
"checksum backtrace 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbbf59b1c43eefa8c3ede390fcc36820b4999f7914104015be25025e0d62af2"
"checksum backtrace-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "44585761d6161b0f57afc49482ab6bd067e4edef48c12a152c237eb0203f7661"
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
"checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
"checksum bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1b7db437d718977f6dc9b2e3fd6fc343c02ac6b899b73fdd2179163447bd9ce9"
"checksum cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
"checksum data-encoding 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "67df0571a74bf0d97fb8b2ed22abdd9a48475c96bd327db968b7d9cace99655e"
"checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82"
"checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b"
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf"
"checksum backtrace 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)" = "18b50f5258d1a9ad8396d2d345827875de4261b158124d4c819d9b351454fae5"
"checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61"
"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d"
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71"
"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4"
"checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b"
"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97"
"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2"
"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1"
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0bab5b5e94f5c31fc764ba5dd9ad16568aae5d4825538c01d6bca680c9bf94a7"
"checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869"
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
"checksum libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "1e5d97d6708edaa407429faa671b942dc0f2727222fb6b6539bf1db936e4b121"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
"checksum mio 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "7da01a5e23070d92d99b1ecd1cd0af36447c6fd44b0fe283c2db199fa136724f"
"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14"
"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319"
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
"checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23"
"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
"checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09"
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
"checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337"
"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9"
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
"checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e"
"checksum scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f417c22df063e9450888a7561788e9bd46d3bb3c1466435b4eccb903807f147d"
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
"checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d"
"checksum smallvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ee4f357e8cd37bf8822e1b964e96fd39e2cb5a0424f8aaa284ccaccc2162411c"
"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db"
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"
"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28"
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
"checksum smallvec 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f90c5e5fe535e48807ab94fc611d323935f39d4660c52b26b96446a7b33aef10"
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c"
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
"checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd"
"checksum tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "52b4e32d8edbf29501aabb3570f027c6ceb00ccef6538f4bddba0200503e74e8"
"checksum tokio-io 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b9532748772222bf70297ec0e2ad0f17213b4a7dd0e6afb68e0a0768f69f4e4f"
"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f"
"checksum tokio 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ec2ffcf4bcfc641413fa0f1427bf8f91dfc78f56a6559cbf50e04837ae442a87"
"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f"
"checksum tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71"
"checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443"
"checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e"
"checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af"
"checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926"
"checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce"
"checksum tokio-sync 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2162248ff317e2bc713b261f242b69dbb838b85248ed20bb21df56d60ea4cae7"
"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119"
"checksum tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72558af20be886ea124595ea0f806dd5703b8958e4705429dd58b3d8231f72f2"
"checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e"
"checksum tokio-trace-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9c8a256d6956f7cb5e2bdfe8b1e8022f1a09206c6c2b1ba00f3b746b260c613"
"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92"
"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445"
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"

View File

@ -1,13 +1,6 @@
[package]
name = "dnsbox"
version = "0.1.0"
authors = ["Stefan Bühler <stbuehler@web.de>"]
[dependencies]
dnsbox-base = { path = "lib/dnsbox-base" }
futures = "0.1.18"
tokio-core = "0.1.12"
tokio-io = "0.1.5"
[workspace]
members = [
"dnsbox",
"lib/dnsbox-base",
"lib/dnsbox-derive",
]

13
dnsbox/Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[package]
name = "dnsbox"
version = "0.1.0"
authors = ["Stefan Bühler <stbuehler@web.de>"]
edition = "2018"
[dependencies]
dnsbox-base = { path = "../lib/dnsbox-base" }
failure = "0.1.5"
futures = "0.1.18"
tokio-core = "0.1.12"
tokio-io = "0.1.5"

View File

@ -1,5 +1,5 @@
use dnsbox_base::common_types::{Type, DnsName};
use dnsbox_base::failure::Error;
use failure::Error;
use dnsbox_base::ser::RRData;
use futures::{Future, Poll, Async};
use futures::unsync::oneshot;

View File

@ -2,16 +2,17 @@
name = "dnsbox-base"
version = "0.1.0"
authors = ["Stefan Bühler <stbuehler@web.de>"]
edition = "2018"
[dependencies]
byteorder = "1.1.0"
bytes = "0.4"
data-encoding = "2.1.0"
dnsbox-derive = { path = "../dnsbox-derive" }
failure = "0.1.1"
lazy_static = "1.0.0"
failure = "0.1.5"
lazy_static = "1.3.0"
log = "0.4"
smallvec = "0.4.4"
data-encoding = "2.1.0"
[features]
no-unsafe = []

View File

@ -1,15 +1,15 @@
use bytes::{Bytes, BufMut};
use data_encoding::{self, HEXLOWER_PERMISSIVE};
use errors::*;
use crate::errors::*;
use failure::{Fail, ResultExt};
use ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes, short_blob, write_short_blob, get_blob};
use ser::text::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes, short_blob, write_short_blob, get_blob};
use crate::ser::text::*;
use std::fmt;
use std::io::Cursor;
static WHITESPACE: &str = "\t\n\x0c\r "; // \f == \x0c formfeed
lazy_static!{
lazy_static::lazy_static!{
pub(crate) static ref HEXLOWER_PERMISSIVE_ALLOW_WS: data_encoding::Encoding = {
let mut spec = data_encoding::Specification::new();
spec.symbols.push_str("0123456789abcdef");
@ -44,14 +44,14 @@ impl DnsPacketData for HexShortBlob {
}
impl DnsTextData for HexShortBlob {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let s = next_field(data)?;
if s == "-" {
Ok(HexShortBlob(Bytes::new()))
} else {
let raw = HEXLOWER_PERMISSIVE.decode(s.as_bytes())
.with_context(|e| e.context(format!("invalid hex: {:?}", s)))?;
ensure!(raw.len() < 256, "short hex field must be at most 255 bytes long");
failure::ensure!(raw.len() < 256, "short hex field must be at most 255 bytes long");
Ok(HexShortBlob(raw.into()))
}
}
@ -82,7 +82,7 @@ impl DnsPacketData for Base64LongBlob {
fn serialize(&self, context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
let len = self.0.len();
ensure!(len < 0x1_0000, "blob too long");
failure::ensure!(len < 0x1_0000, "blob too long");
(len as u16).serialize(context, packet)?;
packet.reserve(len);
packet.put_slice(&self.0);
@ -91,7 +91,7 @@ impl DnsPacketData for Base64LongBlob {
}
impl DnsTextData for Base64LongBlob {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let length_field = next_field(data)?;
let length = length_field.parse::<u16>()
.with_context(|_| format!("invalid length for blob: {:?}", length_field))?;
@ -137,7 +137,7 @@ impl DnsPacketData for Base64RemainingBlob {
}
impl DnsTextData for Base64RemainingBlob {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
skip_whitespace(data);
let result = BASE64_ALLOW_WS.decode(data.as_bytes())
.with_context(|e| e.context(format!("invalid base64: {:?}", data)))?;
@ -174,7 +174,7 @@ impl DnsPacketData for HexRemainingBlob {
}
impl DnsTextData for HexRemainingBlob {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
skip_whitespace(data);
let result = HEXLOWER_PERMISSIVE_ALLOW_WS.decode(data.as_bytes())
.with_context(|e| e.context(format!("invalid hex: {:?}", data)))?;

View File

@ -1,9 +1,9 @@
//! Types and constants for DNS CLASSes
use bytes::Bytes;
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use std::fmt;
use std::io::Cursor;
use std::borrow::Cow;
@ -207,7 +207,7 @@ impl DnsPacketData for Class {
impl DnsTextData for Class {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> Result<Self> {
let field = next_field(data)?;
Class::from_name(field).ok_or_else(|| format_err!("unknown CLASS {:?}", field))
Class::from_name(field).ok_or_else(|| failure::format_err!("unknown CLASS {:?}", field))
}
fn dns_format(&self, f: &mut DnsTextFormatter) -> fmt::Result {

View File

@ -1,7 +1,7 @@
use bytes::Bytes;
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use std::fmt;
use std::io::{Cursor, Read};
@ -16,19 +16,19 @@ fn fmt_eui_hyphens(data: &[u8], f: &mut fmt::Formatter) -> fmt::Result {
fn parse_eui_hyphens(dest: &mut [u8], source: &str) -> Result<()> {
let mut pos = 0;
for octet in source.split('-') {
ensure!(pos < dest.len(), "too many octets for EUI{}", dest.len() * 8);
ensure!(octet.len() == 2, "invalid octet {:?}", octet);
failure::ensure!(pos < dest.len(), "too many octets for EUI{}", dest.len() * 8);
failure::ensure!(octet.len() == 2, "invalid octet {:?}", octet);
match u8::from_str_radix(octet, 16) {
Ok(o) => {
dest[pos] = o;
pos += 1;
},
Err(_) => {
bail!("invalid octet {:?}", octet);
failure::bail!("invalid octet {:?}", octet);
},
}
}
ensure!(pos == dest.len(), "not enough octets for EUI{}", dest.len() * 8);
failure::ensure!(pos == dest.len(), "not enough octets for EUI{}", dest.len() * 8);
Ok(())
}

View File

@ -1,7 +1,7 @@
use bytes::Bytes;
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field, parse_with};
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field, parse_with};
use std::fmt;
use std::io::Cursor;
use std::ops::{Deref, DerefMut};

View File

@ -1,7 +1,7 @@
use bytes::Bytes;
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field, parse_with};
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field, parse_with};
use std::fmt;
use std::io::Cursor;
use std::ops::{Deref, DerefMut};

View File

@ -1,15 +1,15 @@
use bytes::Bytes;
use errors::*;
use crate::errors::*;
use std::fmt;
use std::cmp::Ordering;
#[inline]
fn check_label(label: &[u8]) -> Result<()> {
if label.len() == 0 {
bail!("label must not be empty")
failure::bail!("label must not be empty")
}
if label.len() > 63 {
bail!("label must not be longer than 63 bytes")
failure::bail!("label must not be longer than 63 bytes")
}
Ok(())
}
@ -218,7 +218,7 @@ impl<'a> fmt::Display for DnsLabelRef<'a> {
if c <= 0x21 || c >= 0x7e || b'.' == c || b'\\' == c {
// flush
if done < pos {
w.write_str(::unsafe_ops::from_utf8_unchecked(&self.label[done..pos]))?;
w.write_str(crate::unsafe_ops::from_utf8_unchecked(&self.label[done..pos]))?;
}
match c {
b'.' => w.write_str(r#"\."#)?,
@ -230,7 +230,7 @@ impl<'a> fmt::Display for DnsLabelRef<'a> {
}
// final flush
if done < self.label.len() {
w.write_str(::unsafe_ops::from_utf8_unchecked(&self.label[done..]))?;
w.write_str(crate::unsafe_ops::from_utf8_unchecked(&self.label[done..]))?;
}
Ok(())
}

View File

@ -2,7 +2,7 @@
//! Various structs to represents DNS names and labels
use bytes::Bytes;
use errors::*;
use crate::errors::*;
use smallvec::SmallVec;
use std::io::Cursor;

View File

@ -1,7 +1,7 @@
use bytes::Bytes;
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field, parse_with};
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field, parse_with};
use smallvec::SmallVec;
use std::fmt;
use std::io::Cursor;

View File

@ -44,7 +44,7 @@ impl DnsName {
/// Returns an error if the resulting name would be too long
pub fn push_front<'a, L: Into<DnsLabelRef<'a>>>(&mut self, label: L) -> Result<()> {
let label = label.into();
if label.len() > 254 - self.total_len { bail!("Cannot append label, resulting name too long") }
if label.len() > 254 - self.total_len { failure::bail!("Cannot append label, resulting name too long") }
let (mut data, start) = self.reserve(label.len() as usize + 1, 0);
let new_label_pos = start - (label.len() + 1) as usize;
@ -102,7 +102,7 @@ impl DnsName {
/// Returns an error if the resulting name would be too long
pub fn push_back<'a, L: Into<DnsLabelRef<'a>>>(&mut self, label: L) -> Result<()> {
let label = label.into();
if label.len() > 254 - self.total_len { bail!("Cannot append label, resulting name too long") }
if label.len() > 254 - self.total_len { failure::bail!("Cannot append label, resulting name too long") }
let (mut data, start) = self.reserve(0, label.len() as usize + 1);
let new_label_pos = start + self.total_len as usize - 1;

View File

@ -14,14 +14,14 @@ fn deserialize_name_compressed_cont(data: Bytes, start_pos: usize, uncmpr_offset
let mut pos = start_pos + total_len;
'next_compressed: loop {
{
ensure!(pos + 1 < data.len(), "not enough data for compressed label");
failure::ensure!(pos + 1 < data.len(), "not enough data for compressed label");
let new_pos = ((label_len as usize & 0x3f) << 8) | (data[pos + 1] as usize);
ensure!(new_pos < pos, "Compressed label offset too big: {} >= {}", new_pos, pos);
failure::ensure!(new_pos < pos, "Compressed label offset too big: {} >= {}", new_pos, pos);
pos = new_pos;
}
loop {
ensure!(pos < data.len(), "not enough data for label");
failure::ensure!(pos < data.len(), "not enough data for label");
label_len = data[pos];
if 0 == label_len {
@ -33,11 +33,11 @@ fn deserialize_name_compressed_cont(data: Bytes, start_pos: usize, uncmpr_offset
}
if label_len & 0xc0 == 0xc0 { continue 'next_compressed; }
ensure!(label_len < 64, "Invalid label length {}", label_len);
failure::ensure!(label_len < 64, "Invalid label length {}", label_len);
total_len += 1 + label_len as usize;
// max len 255, but there also needs to be an empty label at the end
if total_len > 254 { bail!("DNS name too long") }
if total_len > 254 { failure::bail!("DNS name too long") }
label_offsets.push(LabelOffset::PacketStart(pos as u16));
pos += 1 + label_len as usize;
@ -63,7 +63,7 @@ pub fn deserialize_name(data: &mut Cursor<Bytes>, accept_compressed: bool) -> Re
}
if label_len & 0xc0 == 0xc0 {
// compressed label
if !accept_compressed { bail!("Invalid label compression {}", label_len) }
if !accept_compressed { failure::bail!("Invalid label compression {}", label_len) }
check_enough_data!(data, 1, "DnsName compressed label target");
// eat second part of compressed label
data.get_u8();
@ -74,10 +74,10 @@ pub fn deserialize_name(data: &mut Cursor<Bytes>, accept_compressed: bool) -> Re
return deserialize_name_compressed_cont(data, start_pos, label_offsets, total_len, label_len as u8);
}
label_offsets.push(total_len as u8);
if label_len > 63 { bail!("Invalid label length {}", label_len) }
if label_len > 63 { failure::bail!("Invalid label length {}", label_len) }
total_len += 1 + label_len;
// max len 255, but there also needs to be an empty label at the end
if total_len > 254 { bail!{"DNS name too long"} }
if total_len > 254 { failure::bail!{"DNS name too long"} }
check_enough_data!(data, label_len, "DnsName label");
data.advance(label_len);
}

View File

@ -1,5 +1,5 @@
use errors::*;
use ser::text::{DnsTextContext, quoted};
use crate::errors::*;
use crate::ser::text::{DnsTextContext, quoted};
use super::{DnsName, DnsLabelRef};
@ -13,35 +13,35 @@ pub fn parse_name(context: &DnsTextContext, value: &str) -> Result<DnsName>
} else if raw == b"@" {
match context.origin() {
Some(o) => return Ok(o.clone()),
None => bail!("@ invalid without $ORIGIN"),
None => failure::bail!("@ invalid without $ORIGIN"),
}
}
ensure!(!raw.is_empty(), "invalid empty name");
failure::ensure!(!raw.is_empty(), "invalid empty name");
let mut label = Vec::new();
let mut pos = 0;
while pos < raw.len() {
if raw[pos] == b'.' {
ensure!(!label.is_empty(), "empty label in name: {:?}", value);
failure::ensure!(!label.is_empty(), "empty label in name: {:?}", value);
name.push_back(DnsLabelRef::new(&label)?)?;
label.clear();
} else if raw[pos] == b'\\' {
ensure!(pos + 1 < raw.len(), "unexpected end of name after backslash: {:?}", value);
failure::ensure!(pos + 1 < raw.len(), "unexpected end of name after backslash: {:?}", value);
if raw[pos+1] >= b'0' && raw[pos+1] <= b'9' {
// \ddd escape
ensure!(pos + 3 < raw.len(), "unexpected end of name after backslash with digit: {:?}", value);
ensure!(raw[pos+2] >= b'0' && raw[pos+2] <= b'9' && raw[pos+3] >= b'0' && raw[pos+3] <= b'9', "expected three digits after backslash in name: {:?}", name);
failure::ensure!(pos + 3 < raw.len(), "unexpected end of name after backslash with digit: {:?}", value);
failure::ensure!(raw[pos+2] >= b'0' && raw[pos+2] <= b'9' && raw[pos+3] >= b'0' && raw[pos+3] <= b'9', "expected three digits after backslash in name: {:?}", name);
let d1 = (raw[pos+1] - b'0') as u32;
let d2 = (raw[pos+2] - b'0') as u32;
let d3 = (raw[pos+3] - b'0') as u32;
let v = d1 * 100 + d2 * 10 + d3;
ensure!(v < 256, "invalid escape in name, {} > 255: {:?}", v, name);
failure::ensure!(v < 256, "invalid escape in name, {} > 255: {:?}", v, name);
label.push(v as u8);
} else {
ensure!(!quoted::is_ascii_whitespace(raw[pos+1]), "whitespace cannot be escaped with backslash prefix; encode it as \\{:03} in: {:?}", raw[pos+1], name);
failure::ensure!(!quoted::is_ascii_whitespace(raw[pos+1]), "whitespace cannot be escaped with backslash prefix; encode it as \\{:03} in: {:?}", raw[pos+1], name);
label.push(raw[pos+1]);
}
} else {
ensure!(!quoted::is_ascii_whitespace(raw[pos]), "whitespace must be encoded as \\{:03} in: {:?}", raw[pos], name);
failure::ensure!(!quoted::is_ascii_whitespace(raw[pos]), "whitespace must be encoded as \\{:03} in: {:?}", raw[pos], name);
label.push(raw[pos]);
}
pos += 1;
@ -57,7 +57,7 @@ pub fn parse_name(context: &DnsTextContext, value: &str) -> Result<DnsName>
Some(o) => {
for l in o { name.push_back(l)?; }
},
None => bail!("missing trailing dot without $ORIGIN"),
None => failure::bail!("missing trailing dot without $ORIGIN"),
}
}

View File

@ -1,8 +1,8 @@
use bytes::Bytes;
use ser::packet;
use ser::packet::DnsPacketData;
use crate::ser::packet;
use crate::ser::packet::DnsPacketData;
use std::io::Cursor;
use errors::*;
use crate::errors::*;
use super::{DnsName, DnsCompressedName, DnsLabelRef, DisplayLabels, DisplayLabelsOptions};
@ -126,7 +126,7 @@ fn de_compressed(bytes: &'static [u8], offset: usize) -> Result<DnsCompressedNam
c.set_position(offset as u64);
let result = DnsPacketData::deserialize(&mut c)?;
if c.remaining() != 0 {
bail!("data remaining: {}", c.remaining())
failure::bail!("data remaining: {}", c.remaining())
}
Ok(result)
}

View File

@ -1,17 +1,17 @@
use bytes::{Bytes, Buf, BufMut};
use common_types::Type;
use crate::common_types::Type;
use data_encoding;
use errors::*;
use crate::errors::*;
use failure::{Fail, ResultExt};
use ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes, short_blob, write_short_blob};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, skip_whitespace, next_field};
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes, short_blob, write_short_blob};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, skip_whitespace, next_field};
use std::collections::BTreeSet;
use std::fmt;
use std::io::Cursor;
static WHITESPACE: &str = "\t\n\x0c\r "; // \f == \x0c formfeed
lazy_static!{
lazy_static::lazy_static!{
static ref BASE32HEX_NOPAD_ALLOW_WS: data_encoding::Encoding = {
let mut spec = data_encoding::Specification::new();
spec.symbols.push_str("0123456789ABCDEFGHIJKLMNOPQRSTUV");
@ -69,7 +69,7 @@ impl NsecTypeBitmap {
}
impl DnsPacketData for NsecTypeBitmap {
fn deserialize(data: &mut Cursor<Bytes>) -> ::errors::Result<Self> {
fn deserialize(data: &mut Cursor<Bytes>) -> crate::errors::Result<Self> {
// remember raw encoding
let raw = {
let mut data: Cursor<Bytes> = data.clone();
@ -79,11 +79,11 @@ impl DnsPacketData for NsecTypeBitmap {
let mut prev_window = None;
while data.has_remaining() {
let window_base = (data.get_u8() as u16) << 8;
ensure!(Some(window_base) > prev_window, "wrong nsec bitmap window order, {:?} <= {:?}", Some(window_base), prev_window);
failure::ensure!(Some(window_base) > prev_window, "wrong nsec bitmap window order, {:?} <= {:?}", Some(window_base), prev_window);
prev_window = Some(window_base);
check_enough_data!(data, 1, "nsec bitmap window length");
let window_len = data.get_u8() as u16;
ensure!(window_len <= 32, "nsec bitmap window too long");
failure::ensure!(window_len <= 32, "nsec bitmap window too long");
check_enough_data!(data, window_len as usize, "nsec bitmap window length");
for i in 0..window_len {
let mut v = data.get_u8();
@ -109,7 +109,7 @@ impl DnsPacketData for NsecTypeBitmap {
}
impl DnsTextData for NsecTypeBitmap {
fn dns_parse(context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let mut set = BTreeSet::new();
skip_whitespace(data);
while !data.is_empty() {
@ -137,23 +137,23 @@ pub struct NextHashedOwnerName(Bytes);
impl DnsPacketData for NextHashedOwnerName {
fn deserialize(data: &mut Cursor<Bytes>) -> Result<Self> {
let text = short_blob(data)?;
ensure!(text.len() > 0, "NextHashedOwnerName must not be empty");
failure::ensure!(text.len() > 0, "NextHashedOwnerName must not be empty");
Ok(NextHashedOwnerName(text))
}
fn serialize(&self, _context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
ensure!(self.0.len() > 0, "NextHashedOwnerName must not be empty");
failure::ensure!(self.0.len() > 0, "NextHashedOwnerName must not be empty");
write_short_blob(&self.0, packet)
}
}
impl DnsTextData for NextHashedOwnerName {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let field = next_field(data)?;
let raw = BASE32HEX_NOPAD_ALLOW_WS.decode(field.as_bytes())
.with_context(|e| e.context(format!("invalid base32hex (no padding): {:?}", field)))?;
ensure!(raw.len() > 0, "NextHashedOwnerName must not be empty");
ensure!(raw.len() < 256, "NextHashedOwnerName field must be at most 255 bytes long");
failure::ensure!(raw.len() > 0, "NextHashedOwnerName must not be empty");
failure::ensure!(raw.len() < 256, "NextHashedOwnerName field must be at most 255 bytes long");
Ok(NextHashedOwnerName(raw.into()))
}

View File

@ -1,8 +1,8 @@
use bytes::{Bytes, Buf, BufMut};
use common_types::Type;
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, skip_whitespace};
use crate::common_types::Type;
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, skip_whitespace};
use std::collections::BTreeSet;
use std::fmt;
use std::io::Cursor;
@ -26,8 +26,8 @@ impl NxtTypeBitmap {
let mut raw = Vec::new();
for t in &set {
ensure!(t.0 > 0, "type 0 cannot be represented in NXT bitmap");
ensure!(t.0 < 128, "type {} cannot be represented in NXT bitmap", t);
failure::ensure!(t.0 > 0, "type 0 cannot be represented in NXT bitmap");
failure::ensure!(t.0 < 128, "type {} cannot be represented in NXT bitmap", t);
let bit_ndx = t.0 as u8;
let byte_ndx = (bit_ndx / 8) as usize;
@ -56,11 +56,11 @@ impl DnsPacketData for NxtTypeBitmap {
let mut set = BTreeSet::new();
let mut current = 0;
while data.has_remaining() {
ensure!(current < 128, "NXT bitmap too long");
failure::ensure!(current < 128, "NXT bitmap too long");
let mut v = data.get_u8();
for _ in 0..7 {
if 0 != v & 0x80 {
ensure!(0 != current, "Type 0 not allowed in NXT bitmap");
failure::ensure!(0 != current, "Type 0 not allowed in NXT bitmap");
set.insert(Type(current));
}
v <<= 1;

View File

@ -1,8 +1,8 @@
use bytes::Bytes;
use errors::*;
use crate::errors::*;
use failure::Fail;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use std::fmt;
use std::io::Cursor;
@ -30,7 +30,7 @@ impl DnsPacketData for OptionalTTL {
}
impl DnsTextData for OptionalTTL {
fn dns_parse(context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let mut data_found = *data;
let field = next_field(&mut data_found)?;
match field.parse::<u32>() {

View File

@ -1,7 +1,7 @@
use bytes::{Bytes, Buf, BufMut};
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext, short_blob, write_short_blob, remaining_bytes};
use ser::text::*;
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext, short_blob, write_short_blob, remaining_bytes};
use crate::ser::text::*;
use std::fmt;
use std::io::Cursor;
@ -20,9 +20,9 @@ impl DnsPacketData for ShortText {
}
impl DnsTextData for ShortText {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let raw = next_quoted_field(data)?;
ensure!(raw.len() < 256, "short text must be at most 255 bytes long");
failure::ensure!(raw.len() < 256, "short text must be at most 255 bytes long");
Ok(ShortText(raw.into()))
}
@ -49,7 +49,7 @@ impl DnsPacketData for LongText {
}
fn serialize(&self, _context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
ensure!(self.0.len() > 0, "empty LongText not allowed");
failure::ensure!(self.0.len() > 0, "empty LongText not allowed");
for t in &self.0 {
write_short_blob(t, packet)?;
}
@ -58,7 +58,7 @@ impl DnsPacketData for LongText {
}
impl DnsTextData for LongText {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let mut result = Vec::new();
// `next_quoted_field` should skip trailing whitespace, we only
// need to skip the beginning whitespace for the first
@ -66,7 +66,7 @@ impl DnsTextData for LongText {
skip_whitespace(data);
while !data.is_empty() {
let part = next_quoted_field(data)?;
ensure!(part.len() < 256, "long text component must be at most 255 bytes long");
failure::ensure!(part.len() < 256, "long text component must be at most 255 bytes long");
result.push(part.into());
}
Ok(LongText(result))
@ -96,9 +96,9 @@ impl DnsPacketData for UnquotedShortText {
}
impl DnsTextData for UnquotedShortText {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let raw = next_quoted_field(data)?;
ensure!(raw.len() < 256, "short text must be at most 255 bytes long");
failure::ensure!(raw.len() < 256, "short text must be at most 255 bytes long");
Ok(UnquotedShortText(raw.into()))
}
@ -127,7 +127,7 @@ impl DnsPacketData for RemainingText {
}
impl DnsTextData for RemainingText {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
Ok(RemainingText(next_quoted_field(data)?.into()))
}

View File

@ -2,7 +2,7 @@
//!
//! year 0 is "1 BC", year -1 is "2 BC" and so on
use errors::*;
use crate::errors::*;
use std::fmt;
fn is_leap_year(year: i16) -> bool {
@ -223,11 +223,11 @@ impl Tm {
pub fn from_epoch(epoch: i64) -> Result<Self> {
let (day, time_of_day) = pos_div_rem64(epoch, 86400);
let days_since_march1_y0 = day + EPOCH_DAYS_SINCE_MARCH1_Y0 as i64;
ensure!((days_since_march1_y0 as i32) as i64 == days_since_march1_y0, "days in epoch out of range");
failure::ensure!((days_since_march1_y0 as i32) as i64 == days_since_march1_y0, "days in epoch out of range");
let days_since_march1_y0 = days_since_march1_y0 as i32;
let (year, month, day) = split_days_since_march1_y0(days_since_march1_y0);
ensure!((year as i16) as i32 == year, "year in epoch out of range");
failure::ensure!((year as i16) as i32 == year, "year in epoch out of range");
let year = year as i16;
let (minute_of_day, second) = pos_div_rem(time_of_day as i32, 60);
@ -260,15 +260,15 @@ impl Tm {
#[allow(non_snake_case)]
pub fn parse_YYYYMMDDHHmmSS(s: &str) -> Result<Self> {
ensure!(s.len() == 14, "Tm string must be exactly 14 digits long");
ensure!(s.as_bytes().iter().all(|&b| b >= b'0' && b <= b'9'), "Tm string must be exactly 14 digits long");
failure::ensure!(s.len() == 14, "Tm string must be exactly 14 digits long");
failure::ensure!(s.as_bytes().iter().all(|&b| b >= b'0' && b <= b'9'), "Tm string must be exactly 14 digits long");
let year = s[0..4].parse::<i16>()?;
ensure!(year >= 1, "year must be >= 1");
ensure!(year <= 9999, "year must be <= 9999");
failure::ensure!(year >= 1, "year must be >= 1");
failure::ensure!(year <= 9999, "year must be <= 9999");
fn p(s: &str, min: u8, max: u8, name: &'static str) -> ::errors::Result<u8> {
fn p(s: &str, min: u8, max: u8, name: &'static str) -> crate::errors::Result<u8> {
let v = s.parse::<u8>()?;
ensure!(v >= min && v <= max, "{} {} out of range {}-{}", name, v, min, max);
failure::ensure!(v >= min && v <= max, "{} {} out of range {}-{}", name, v, min, max);
Ok(v)
}
@ -279,12 +279,12 @@ impl Tm {
let second = p(&s[12..14], 0, 59, "second")?;
if 2 == month {
ensure!(day < 30, "day {} out of range in february", day);
ensure!(is_leap_year(year) || day < 29, "day {} out of range in february (not a leap year)", day);
failure::ensure!(day < 30, "day {} out of range in february", day);
failure::ensure!(is_leap_year(year) || day < 29, "day {} out of range in february (not a leap year)", day);
} else {
static DAYS_IN_MONTHS: [u8; 12] = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
let max_days = DAYS_IN_MONTHS[month as usize - 1];
ensure!(day <= max_days, "day {} out of range for month {}", day, month);
failure::ensure!(day <= max_days, "day {} out of range for month {}", day, month);
}
Ok(Tm{ year, month, day, hour, minute, second })

View File

@ -1,7 +1,7 @@
use bytes::Bytes;
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use std::fmt;
use std::io::Cursor;
@ -27,7 +27,7 @@ impl DnsPacketData for Time {
}
impl DnsTextData for Time {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let field = next_field(data)?;
let epoch = field.parse::<u32>();
if field.len() == 14 && epoch.is_err() {
@ -62,7 +62,7 @@ impl DnsPacketData for TimeStrict {
}
impl DnsTextData for TimeStrict {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let field = next_field(data)?;
let tm = epoch::Tm::parse_YYYYMMDDHHmmSS(field)?;
Ok(TimeStrict(tm.epoch() as u32))
@ -87,7 +87,7 @@ impl DnsPacketData for Time48 {
}
fn serialize(&self, context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
ensure!(self.0 <= TIME48_MAX, "time48 overflow");
failure::ensure!(self.0 <= TIME48_MAX, "time48 overflow");
let high16 = (self.0 >> 32) as u16;
let low32 = self.0 as u32;
high16.serialize(context, packet)?;
@ -97,10 +97,10 @@ impl DnsPacketData for Time48 {
}
impl DnsTextData for Time48 {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let field = next_field(data)?;
let epoch = field.parse::<u64>()?;
ensure!(epoch <= TIME48_MAX, "time48 overflow");
failure::ensure!(epoch <= TIME48_MAX, "time48 overflow");
Ok(Time48(epoch))
}

View File

@ -1,10 +1,10 @@
//! Types and constants for DNS TYPes
use bytes::Bytes;
use errors::*;
use records::registry::{lookup_type_to_name, lookup_type_name};
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use crate::errors::*;
use crate::records::registry::{lookup_type_to_name, lookup_type_name};
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use std::borrow::Cow;
use std::fmt;
use std::io::Cursor;
@ -581,7 +581,7 @@ impl DnsPacketData for Type {
impl DnsTextData for Type {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> Result<Self> {
let field = next_field(data)?;
Type::from_name(field).ok_or_else(|| format_err!("unknown TYPE {:?}", field))
Type::from_name(field).ok_or_else(|| failure::format_err!("unknown TYPE {:?}", field))
}
fn dns_format(&self, f: &mut DnsTextFormatter) -> fmt::Result {
@ -593,7 +593,7 @@ impl DnsTextData for Type {
macro_rules! check_type {
($t:ident, $dec:expr) => {
{
use records::registry;
use $crate::records::registry;
// compare decimal value
assert_eq!($t, Type($dec), "wrong decimal value for {}", stringify!($t));
// make sure it's registered
@ -602,7 +602,7 @@ macro_rules! check_type {
};
($t:ident, $dec:expr, $name:expr) => {
{
use records::registry;
use $crate::records::registry;
// compare decimal value
assert_eq!($t, Type($dec), "wrong decimal value for {}", stringify!($t));
// make sure it's registered

View File

@ -1,7 +1,7 @@
use bytes::{Bytes, BufMut};
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes};
use ser::text::*;
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes};
use crate::ser::text::*;
use std::fmt;
use std::io::Cursor;
@ -18,12 +18,12 @@ pub struct UriText(Bytes);
impl DnsPacketData for UriText {
fn deserialize(data: &mut Cursor<Bytes>) -> Result<Self> {
let raw = remaining_bytes(data);
ensure!(!raw.is_empty(), "URI must not be empty");
failure::ensure!(!raw.is_empty(), "URI must not be empty");
Ok(UriText(raw))
}
fn serialize(&self, _context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
ensure!(!self.0.is_empty(), "URI must not be empty");
failure::ensure!(!self.0.is_empty(), "URI must not be empty");
packet.reserve(self.0.len());
packet.put_slice(&self.0);
Ok(())
@ -31,9 +31,9 @@ impl DnsPacketData for UriText {
}
impl DnsTextData for UriText {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
let raw = next_quoted_field(data)?;
ensure!(!raw.is_empty(), "URI must not be empty");
failure::ensure!(!raw.is_empty(), "URI must not be empty");
Ok(UriText(raw.into()))
}

View File

@ -15,7 +15,7 @@ pub struct NotEnoughData {
impl NotEnoughData {
pub fn check(data: &mut io::Cursor<Bytes>, need: usize) -> Result<()> {
if data.remaining() < need {
bail!(NotEnoughData{
failure::bail!(NotEnoughData{
position: data.position(),
data: data.get_ref().clone(),
})
@ -35,7 +35,7 @@ impl failure::Fail for NotEnoughData {}
macro_rules! check_enough_data {
($data:ident, $n:expr, $context:expr) => {
{
use $crate::failure::ResultExt;
use $crate::_failure::ResultExt;
$crate::errors::NotEnoughData::check($data, $n).context($context)?;
}
};

View File

@ -1,26 +1,15 @@
pub extern crate byteorder;
pub extern crate bytes;
pub extern crate data_encoding;
#[macro_use]
pub extern crate failure;
#[doc(hidden)]
pub use failure as _failure; // re-export for macros
#[doc(hidden)]
pub use bytes as _bytes; // re-export for macros
#[macro_use]
extern crate dnsbox_derive;
extern crate smallvec;
#[macro_use]
extern crate lazy_static;
mod unsafe_ops;
extern crate self as dnsbox_base;
#[macro_use]
pub mod errors;
pub mod common_types;
pub mod ser;
pub mod packet;
pub mod records;
pub mod ser;
// dnsbox_derive will use ::dnsbox_base::...; make this work in this crate too.
mod dnsbox_base {
#[allow(unused_imports)]
pub use super::*;
}
mod unsafe_ops;

View File

@ -1,11 +1,11 @@
use byteorder::ByteOrder;
use bytes::{Bytes, Buf, BufMut, BigEndian};
use common_types::{Type, Class, DnsCompressedName, types};
use errors::*;
use ser::RRData;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::common_types::{Type, Class, DnsCompressedName, types};
use crate::errors::*;
use crate::ser::RRData;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use std::io::Cursor;
use records::registry::deserialize_rr_data;
use crate::records::registry::deserialize_rr_data;
pub mod opt;
@ -123,7 +123,7 @@ impl DnsPacketData for Resource {
rrdata.advance(pos);
let rd = deserialize_rr_data(ttl, class, rr_type, &mut rrdata)?;
ensure!(!rrdata.has_remaining(), "data remaining: {} bytes", rrdata.remaining());
failure::ensure!(!rrdata.has_remaining(), "data remaining: {} bytes", rrdata.remaining());
Ok(Resource{
name,
@ -142,14 +142,14 @@ impl DnsPacketData for Resource {
let rdlen_pos = packet.len();
packet.reserve(2);
packet.put_u16::<BigEndian>(0); // stub
packet.put_u16_be(0); // stub
let rd_start = packet.len();
self.data.serialize_rr_data(context, packet)?;
let rd_end = packet.len();
let rdlen = rd_end - rd_start;
ensure!(rdlen < 0x1_0000, "RDATA too big");
failure::ensure!(rdlen < 0x1_0000, "RDATA too big");
// now patch length
BigEndian::write_u16(&mut packet[rdlen_pos..][..2], rdlen as u16);
@ -191,7 +191,7 @@ impl DnsPacket {
self.additional.retain(|r| r.data.rr_type() != types::OPT);
match self.opt.take() {
Some(Err(e)) => bail!("can't serialize broken OPT: {:?}", e),
Some(Err(e)) => failure::bail!("can't serialize broken OPT: {:?}", e),
Some(Ok(opt)) => {
self.additional.push(opt.serialize()?);
},
@ -233,7 +233,7 @@ impl DnsPacketData for DnsPacket {
for (i, r) in p.additional.iter().enumerate() {
if r.data.rr_type() == types::OPT {
ensure!(opt_resource_ndx.is_none(), "multiple OPT resource records");
failure::ensure!(opt_resource_ndx.is_none(), "multiple OPT resource records");
opt_resource_ndx = Some(i);
}
}
@ -247,10 +247,10 @@ impl DnsPacketData for DnsPacket {
}
fn serialize(&self, context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
ensure!(self.question.len() < 0x1_0000, "too many question entries");
ensure!(self.answer.len() < 0x1_0000, "too many answer entries");
ensure!(self.authority.len() < 0x1_0000, "too many authority entries");
ensure!(self.additional.len() < 0x1_0000, "too many additional entries");
failure::ensure!(self.question.len() < 0x1_0000, "too many question entries");
failure::ensure!(self.answer.len() < 0x1_0000, "too many answer entries");
failure::ensure!(self.authority.len() < 0x1_0000, "too many authority entries");
failure::ensure!(self.additional.len() < 0x1_0000, "too many additional entries");
let header = DnsHeader{
id: self.id,
flags: self.flags,

View File

@ -1,10 +1,10 @@
use byteorder::ByteOrder;
use bytes::{Bytes, Buf, BufMut, BigEndian};
use common_types::{DnsCompressedName, Class, types};
use errors::*;
use packet::Resource;
use records::UnknownRecord;
use ser::packet::{DnsPacketData, DnsPacketWriteContext, get_blob, remaining_bytes};
use crate::common_types::{DnsCompressedName, Class, types};
use crate::errors::*;
use crate::packet::Resource;
use crate::records::UnknownRecord;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext, get_blob, remaining_bytes};
use std::io::{Cursor, Read};
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
@ -74,30 +74,30 @@ impl DnsOption {
let source_prefix_length = u8::deserialize(data)?;
let scope_prefix_length = u8::deserialize(data)?;
let addr_prefix_len = ((source_prefix_length + 7) / 8) as usize;
ensure!(scope_prefix_length <= source_prefix_length, "scope prefix {} > source prefix {}", scope_prefix_length, source_prefix_length);
failure::ensure!(scope_prefix_length <= source_prefix_length, "scope prefix {} > source prefix {}", scope_prefix_length, source_prefix_length);
let addr = match addr_family {
1 => {
ensure!(source_prefix_length <= 32, "invalid prefix for IPv4");
failure::ensure!(source_prefix_length <= 32, "invalid prefix for IPv4");
let mut o = [0u8; 4];
data.read_exact(&mut o[0..addr_prefix_len])?;
if 0 != source_prefix_length % 8 {
let mask = 0xff >> (source_prefix_length % 8);
ensure!(0 == o[addr_prefix_len - 1] & mask, "non-zero padding");
failure::ensure!(0 == o[addr_prefix_len - 1] & mask, "non-zero padding");
}
IpAddr::V4(Ipv4Addr::from(o))
},
2 => {
ensure!(source_prefix_length <= 128, "invalid prefix for IPv6");
failure::ensure!(source_prefix_length <= 128, "invalid prefix for IPv6");
let mut o = [0u8; 16];
data.read_exact(&mut o[0..addr_prefix_len])?;
if 0 != source_prefix_length % 8 {
let mask = 0xff >> (source_prefix_length % 8);
ensure!(0 == o[addr_prefix_len - 1] & mask, "non-zero padding");
failure::ensure!(0 == o[addr_prefix_len - 1] & mask, "non-zero padding");
}
IpAddr::V6(Ipv6Addr::from(o))
},
_ => {
bail!("unknown address family {}", addr_family);
failure::bail!("unknown address family {}", addr_family);
},
};
Ok(DnsOption::ClientSubnet{
@ -113,10 +113,10 @@ impl DnsOption {
let result = (|| Ok(match code {
0x0003 => DnsOption::NSID(remaining_bytes(&mut data)),
0x0008 => DnsOption::parse_client_subnet(&mut data)?,
_ => bail!("unknown option {}", code),
_ => failure::bail!("unknown option {}", code),
}))()?;
ensure!(!data.has_remaining(), "option data remaining: {} bytes", data.remaining());
failure::ensure!(!data.has_remaining(), "option data remaining: {} bytes", data.remaining());
Ok(result)
}
@ -130,7 +130,7 @@ impl DnsOption {
DnsOption::ClientSubnet{source_prefix_length, scope_prefix_length, ref addr} => {
let addr_prefix_len = ((source_prefix_length + 7) / 8) as usize;
packet.reserve(4 + addr_prefix_len);
packet.put_u16::<BigEndian>(match *addr {
packet.put_u16_be(match *addr {
IpAddr::V4(_) => 1,
IpAddr::V6(_) => 2,
});
@ -182,14 +182,14 @@ impl DnsPacketData for DnsOption {
let opt_len_pos = packet.len();
packet.reserve(2);
packet.put_u16::<BigEndian>(0); // stub
packet.put_u16_be(0); // stub
let opt_start = packet.len();
self.write_opt_data(context, packet)?;
let opt_end = packet.len();
let opt_len = opt_end - opt_start;
ensure!(opt_len < 0x1_0000, "OPTION DATA too big");
failure::ensure!(opt_len < 0x1_0000, "OPTION DATA too big");
// now patch length
BigEndian::write_u16(&mut packet[opt_len_pos..][..2], opt_len as u16);
@ -234,7 +234,7 @@ impl Opt {
let ur = match r.data.as_any().downcast_ref::<UnknownRecord>() {
Some(ur) => ur,
None => bail!("need to parse OPT from UnknownRecord"),
None => failure::bail!("need to parse OPT from UnknownRecord"),
};
let options = match Opt::deserialize_options(ur) {

View File

@ -1,13 +1,13 @@
#![allow(non_snake_case)]
use bytes::Bytes;
use common_types::{DnsName, DnsCompressedName, Class, Type, types, classes};
use errors::*;
use packet::*;
use packet::opt::{Opt, DnsOption};
use records::{UnknownRecord, registry, A};
use ser::{RRData, RRDataText, text};
use ser::packet::{DnsPacketData, deserialize_with};
use crate::common_types::{DnsName, DnsCompressedName, Class, Type, types, classes};
use crate::errors::*;
use crate::packet::*;
use crate::packet::opt::{Opt, DnsOption};
use crate::records::{UnknownRecord, registry, A};
use crate::ser::{RRData, text};
use crate::ser::packet::{DnsPacketData, deserialize_with};
use std::io::Cursor;
fn fake_packet(rrtype: Type, raw: &[u8]) -> Bytes {
@ -41,7 +41,7 @@ fn get_first_answer_rdata(packet: Bytes) -> Result<Bytes> {
Question::deserialize(data)?;
}
ensure!(header.ancount > 0, "need at least one answer");
failure::ensure!(header.ancount > 0, "need at least one answer");
let _name = DnsCompressedName::deserialize(data)?;
let _rr_type = Type::deserialize(data)?;

View File

@ -4,16 +4,16 @@ use std::collections::HashMap;
use std::io::Cursor;
use std::marker::PhantomData;
use common_types::{Class, Type, types};
use errors::*;
use records::structs;
use ser::{RRData, StaticRRData};
use ser::text::DnsTextContext;
use crate::common_types::{Class, Type, types};
use crate::errors::*;
use crate::records::structs;
use crate::ser::{RRData, StaticRRData};
use crate::ser::text::DnsTextContext;
// this should be enough for registered names
const TYPE_NAME_MAX_LEN: usize = 16;
lazy_static!{
lazy_static::lazy_static!{
static ref REGISTRY: Registry = Registry::init();
}
@ -54,11 +54,11 @@ pub fn parse_rr_data(context: &DnsTextContext, data: &mut &str) -> Result<Box<RR
let registry = registry();
let t = match context.record_type() {
Some(t) => t,
None => bail!("require record type to parse record data"),
None => failure::bail!("require record type to parse record data"),
};
match registry.type_parser.get(&t) {
Some(p) => p.parse_rr_data(context, data),
None => bail!("unknown type: {}", t),
None => failure::bail!("unknown type: {}", t),
}
}

View File

@ -1,6 +1,8 @@
use common_types::*;
use crate::common_types::*;
use std::net::{Ipv4Addr, Ipv6Addr};
use crate::ser::{packet::DnsPacketData, text::DnsTextData, RRData};
// unless otherwise documented, class should probably be IN (0x0001)
// deriving RRData will add a unit test to make sure the type is

View File

@ -1,23 +1,23 @@
use bytes::{Bytes, Buf};
use common_types::classes;
use crate::common_types::classes;
use failure::ResultExt;
use records::structs;
use ser::{StaticRRData, packet, text};
use ser::packet::DnsPacketData;
use crate::records::structs;
use crate::ser::{StaticRRData, packet, text};
use crate::ser::packet::DnsPacketData;
use std::fmt;
use std::io::Cursor;
fn rrdata_de<T>(data: &'static [u8]) -> ::errors::Result<T>
fn rrdata_de<T>(data: &'static [u8]) -> crate::errors::Result<T>
where
T: StaticRRData
{
let mut data = Cursor::new(Bytes::from_static(data));
let result = T::deserialize_rr_data(3600, classes::IN, T::TYPE, &mut data)?;
ensure!(!data.has_remaining(), "rrdata not read completely");
failure::ensure!(!data.has_remaining(), "rrdata not read completely");
Ok(result)
}
fn rrdata_parse<T>(data: &str) -> ::errors::Result<T>
fn rrdata_parse<T>(data: &str) -> crate::errors::Result<T>
where
T: StaticRRData
{
@ -30,30 +30,30 @@ where
})
}
fn check<T>(txt: &str, data: &'static [u8]) -> ::errors::Result<()>
fn check<T>(txt: &str, data: &'static [u8]) -> crate::errors::Result<()>
where
T: StaticRRData + fmt::Debug + PartialEq
{
let d1: T = rrdata_de(data).context("couldn't parse binary record")?;
let d2: T = rrdata_parse(txt).context("couldn't parse text record")?;
ensure!(d1 == d2, "decoded data not equal: {:?} != {:?}", d1, d2);
failure::ensure!(d1 == d2, "decoded data not equal: {:?} != {:?}", d1, d2);
Ok(())
}
fn check2<T>(txt: &str, data: &'static [u8], canon: &str) -> ::errors::Result<()>
fn check2<T>(txt: &str, data: &'static [u8], canon: &str) -> crate::errors::Result<()>
where
T: StaticRRData + fmt::Debug + PartialEq
{
let d1: T = rrdata_de(data).context("couldn't parse binary record")?;
let d2: T = rrdata_parse(txt).context("couldn't parse text record")?;
ensure!(d1 == d2, "decoded data not equal: {:?} != {:?}", d1, d2);
failure::ensure!(d1 == d2, "decoded data not equal: {:?} != {:?}", d1, d2);
let d1_text = d1.text().unwrap();
let d2_text = d2.text().unwrap();
let canon_text = (T::NAME.to_owned(), canon.into());
ensure!(d1_text == canon_text, "re-formatted binary record not equal to canonical representation: {:?} != {:?}", d1_text, canon_text);
ensure!(d2_text == canon_text, "re-formatted text record not equal to canonical representation: {:?} != {:?}", d2_text, canon_text);
failure::ensure!(d1_text == canon_text, "re-formatted binary record not equal to canonical representation: {:?} != {:?}", d1_text, canon_text);
failure::ensure!(d2_text == canon_text, "re-formatted text record not equal to canonical representation: {:?} != {:?}", d2_text, canon_text);
Ok(())
}

View File

@ -1,11 +1,11 @@
use bytes::{Bytes, BufMut};
use common_types::*;
use common_types::binary::HEXLOWER_PERMISSIVE_ALLOW_WS;
use errors::*;
use crate::common_types::*;
use crate::common_types::binary::HEXLOWER_PERMISSIVE_ALLOW_WS;
use crate::errors::*;
use failure::{ResultExt, Fail};
use ser::packet::{DnsPacketWriteContext, remaining_bytes};
use ser::{RRData, RRDataPacket, RRDataText};
use ser::text::{DnsTextFormatter, DnsTextContext, next_field};
use crate::ser::packet::{DnsPacketWriteContext, remaining_bytes};
use crate::ser::{RRData, RRDataPacket, RRDataText};
use crate::ser::text::{DnsTextFormatter, DnsTextContext, next_field};
use std::borrow::Cow;
use std::fmt;
use std::io::Cursor;
@ -34,13 +34,13 @@ impl UnknownRecord {
pub fn dns_parse(rr_type: Type, data: &mut &str) -> Result<Self> {
let field = next_field(data)?;
ensure!(field == r"\#", "expect \\# token to mark generic encoding");
failure::ensure!(field == r"\#", "expect \\# token to mark generic encoding");
let field = next_field(data).context("generic record data length")?;
let len: usize = field.parse()?;
let result = HEXLOWER_PERMISSIVE_ALLOW_WS.decode(data.as_bytes())
.with_context(|e| e.context(format!("invalid hex: {:?}", data)))?;
ensure!(len == result.len(), "length {} doesn't match length of encoded data {}", len, result.len());
failure::ensure!(len == result.len(), "length {} doesn't match length of encoded data {}", len, result.len());
*data = ""; // read all data
Ok(UnknownRecord {
@ -73,7 +73,7 @@ impl RRDataText for UnknownRecord {
{
let t = match context.record_type() {
Some(t) => t,
None => bail!("must parse DNS record with record type context"),
None => failure::bail!("must parse DNS record with record type context"),
};
UnknownRecord::dns_parse(t, data)

View File

@ -1,9 +1,10 @@
use bytes::{Bytes, Buf, BufMut};
use errors::*;
use common_types::*;
use crate::errors::*;
use crate::common_types::*;
use failure::ResultExt;
use ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use crate::ser::RRData;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext, remaining_bytes};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use std::fmt;
use std::io::Read;
use std::net::{Ipv4Addr, Ipv6Addr};
@ -55,49 +56,49 @@ impl DnsPacketData for LOC {
impl DnsTextData for LOC {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> Result<Self> {
let degrees_latitude = next_field(data)?.parse::<u8>()?;
ensure!(degrees_latitude <= 90, "degrees latitude out of range: {}", degrees_latitude);
failure::ensure!(degrees_latitude <= 90, "degrees latitude out of range: {}", degrees_latitude);
let mut minutes_latitude = 0;
let mut seconds_latitude = 0.0;
let mut field = next_field(data)?;
if field != "N" && field != "n" && field != "S" && field != "s" {
minutes_latitude = field.parse::<u8>()?;
ensure!(minutes_latitude < 60, "minutes latitude out of range: {}", minutes_latitude);
failure::ensure!(minutes_latitude < 60, "minutes latitude out of range: {}", minutes_latitude);
field = next_field(data)?;
if field != "N" && field != "n" && field != "S" && field != "s" {
seconds_latitude = field.parse::<f32>()?;
ensure!(seconds_latitude >= 0.0 && seconds_latitude < 60.0, "seconds latitude out of range: {}", seconds_latitude);
failure::ensure!(seconds_latitude >= 0.0 && seconds_latitude < 60.0, "seconds latitude out of range: {}", seconds_latitude);
field = next_field(data)?;
}
}
let latitude_off = (3600_000 * degrees_latitude as u32) + (60_000 * minutes_latitude as u32) + (1_000.0 * seconds_latitude).round() as u32;
ensure!(latitude_off <= 3600_000 * 180, "latitude out of range");
failure::ensure!(latitude_off <= 3600_000 * 180, "latitude out of range");
let latitude = match field {
"N"|"n" => 0x8000_0000 + latitude_off,
"S"|"s" => 0x8000_0000 - latitude_off,
_ => bail!("invalid latitude orientation [NS]: {}", field),
_ => failure::bail!("invalid latitude orientation [NS]: {}", field),
};
let degrees_longitude = next_field(data)?.parse::<u8>()?;
ensure!(degrees_longitude <= 180, "degrees longitude out of range: {}", degrees_longitude);
failure::ensure!(degrees_longitude <= 180, "degrees longitude out of range: {}", degrees_longitude);
let mut minutes_longitude = 0;
let mut seconds_longitude = 0.0;
let mut field = next_field(data)?;
if field != "E" && field != "e" && field != "W" && field != "w" {
minutes_longitude = field.parse::<u8>()?;
ensure!(minutes_longitude < 60, "minutes longitude out of range: {}", minutes_longitude);
failure::ensure!(minutes_longitude < 60, "minutes longitude out of range: {}", minutes_longitude);
field = next_field(data)?;
if field != "E" && field != "e" && field != "W" && field != "w" {
seconds_longitude = field.parse::<f32>()?;
ensure!(seconds_longitude >= 0.0 && seconds_longitude < 60.0, "seconds longitude out of range: {}", seconds_longitude);
failure::ensure!(seconds_longitude >= 0.0 && seconds_longitude < 60.0, "seconds longitude out of range: {}", seconds_longitude);
field = next_field(data)?;
}
}
let longitude_off = (3600_000 * degrees_longitude as u32) + (60_000 * minutes_longitude as u32) + (1_000.0 * seconds_longitude).round() as u32;
ensure!(longitude_off <= 3600_000 * 180, "longitude out of range");
failure::ensure!(longitude_off <= 3600_000 * 180, "longitude out of range");
let longitude = match field {
"E"|"e" => 0x8000_0000 + longitude_off,
"W"|"w" => 0x8000_0000 - longitude_off,
_ => bail!("invalid longitude orientation [EW]: {}", field),
_ => failure::bail!("invalid longitude orientation [EW]: {}", field),
};
fn trim_unit_m(s: &str) -> &str {
@ -111,11 +112,11 @@ impl DnsTextData for LOC {
let mut dec_point = None;
for &b in s.as_bytes() {
if b == b'.' {
ensure!(dec_point.is_none(), "invalid precision (double decimal point): {:?}", s);
failure::ensure!(dec_point.is_none(), "invalid precision (double decimal point): {:?}", s);
dec_point = Some(0);
continue;
}
ensure!(b >= b'0' && b <= b'9', "invalid precision (invalid character): {:?}", s);
failure::ensure!(b >= b'0' && b <= b'9', "invalid precision (invalid character): {:?}", s);
if let Some(ref mut dp) = dec_point {
if *dp == 2 { continue; } // ignore following digits
*dp += 1;
@ -125,11 +126,11 @@ impl DnsTextData for LOC {
m = d;
} else {
e += 1;
ensure!(e <= 9, "invalid precision (overflow): {:?}", s);
failure::ensure!(e <= 9, "invalid precision (overflow): {:?}", s);
}
}
e += 2 - dec_point.unwrap_or(0);
ensure!(e <= 9, "invalid precision (overflow): {:?}", s);
failure::ensure!(e <= 9, "invalid precision (overflow): {:?}", s);
Ok(m << 4 | e)
}
@ -137,7 +138,7 @@ impl DnsTextData for LOC {
Ok(field) => {
let f_altitude = trim_unit_m(field).parse::<f64>()?;
let altitude = (f_altitude * 100.0 + 10000000.0).round() as i64;
ensure!(altitude > 0 && (altitude as u32) as i64 == altitude, "altitude out of range");
failure::ensure!(altitude > 0 && (altitude as u32) as i64 == altitude, "altitude out of range");
altitude as u32
},
// standard requires the field, but the example parser doesn't..
@ -263,7 +264,7 @@ impl DnsPacketData for A6 {
fn deserialize(data: &mut ::std::io::Cursor<Bytes>) -> Result<Self> {
let prefix: u8 = DnsPacketData::deserialize(data)
.context("failed parsing field A6::prefix")?;
ensure!(prefix <= 128, "invalid A6::prefix {}", prefix);
failure::ensure!(prefix <= 128, "invalid A6::prefix {}", prefix);
let suffix_offset = (prefix / 8) as usize;
debug_assert!(suffix_offset <= 16);
let suffix_len = 16 - suffix_offset;
@ -311,7 +312,7 @@ impl DnsTextData for A6 {
fn dns_parse(context: &DnsTextContext, data: &mut &str) -> Result<Self> {
let prefix: u8 = DnsTextData::dns_parse(context, data)
.context("failed parsing field A6::prefix")?;
ensure!(prefix <= 128, "invalid A6::prefix {}", prefix);
failure::ensure!(prefix <= 128, "invalid A6::prefix {}", prefix);
let suffix_offset = (prefix / 8) as usize;
debug_assert!(suffix_offset <= 16);
@ -453,7 +454,7 @@ impl DnsTextData for IPSECKEY {
1 => IpsecKeyGateway::Ipv4(Ipv4Addr::dns_parse(context, data)?),
2 => IpsecKeyGateway::Ipv6(Ipv6Addr::dns_parse(context, data)?),
3 => IpsecKeyGateway::Name(DnsName::dns_parse(context, data)?),
_ => bail!("unknown gateway type {} for IPSECKEY", gateway_type),
_ => failure::bail!("unknown gateway type {} for IPSECKEY", gateway_type),
};
Ok(IPSECKEY::Known{
precedence,

View File

@ -1,5 +1,5 @@
use bytes::{Bytes, Buf, BufMut};
use errors::*;
use crate::errors::*;
use std::io::Cursor;
mod std_impls;
@ -7,6 +7,8 @@ mod write;
pub use self::write::*;
pub use dnsbox_derive::DnsPacketData;
pub trait DnsPacketData: Sized {
fn deserialize(data: &mut Cursor<Bytes>) -> Result<Self>;
fn serialize(&self, context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()>;
@ -18,7 +20,7 @@ where
{
let mut c = Cursor::new(data);
let result = parser(&mut c)?;
ensure!(!c.has_remaining(), "data remaining: {} bytes", c.remaining());
failure::ensure!(!c.has_remaining(), "data remaining: {} bytes", c.remaining());
Ok(result)
}
@ -45,7 +47,7 @@ pub fn short_blob(data: &mut Cursor<Bytes>) -> Result<Bytes> {
}
pub fn write_short_blob(data: &[u8], packet: &mut Vec<u8>) -> Result<()> {
ensure!(data.len() < 256, "short blob must be at most 255 bytes long");
failure::ensure!(data.len() < 256, "short blob must be at most 255 bytes long");
packet.reserve(data.len() + 1);
packet.put_u8(data.len() as u8);
packet.put_slice(data);

View File

@ -1,6 +1,6 @@
use bytes::{Bytes, Buf, BufMut, BigEndian};
use errors::*;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use bytes::{Bytes, Buf, BufMut};
use crate::errors::*;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use std::io::{Cursor, Read};
use std::mem::size_of;
use std::net::{Ipv4Addr, Ipv6Addr};
@ -21,12 +21,12 @@ impl DnsPacketData for u8 {
impl DnsPacketData for u16 {
fn deserialize(data: &mut Cursor<Bytes>) -> Result<Self> {
check_enough_data!(data, size_of::<Self>(), "u16");
Ok(data.get_u16::<BigEndian>())
Ok(data.get_u16_be())
}
fn serialize(&self, _context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
packet.reserve(size_of::<Self>());
packet.put_u16::<BigEndian>(*self);
packet.put_u16_be(*self);
Ok(())
}
}
@ -34,12 +34,12 @@ impl DnsPacketData for u16 {
impl DnsPacketData for u32 {
fn deserialize(data: &mut Cursor<Bytes>) -> Result<Self> {
check_enough_data!(data, size_of::<Self>(), "u32");
Ok(data.get_u32::<BigEndian>())
Ok(data.get_u32_be())
}
fn serialize(&self, _context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
packet.reserve(size_of::<Self>());
packet.put_u32::<BigEndian>(*self);
packet.put_u32_be(*self);
Ok(())
}
}
@ -47,7 +47,7 @@ impl DnsPacketData for u32 {
impl DnsPacketData for Ipv4Addr {
fn deserialize(data: &mut Cursor<Bytes>) -> Result<Self> {
check_enough_data!(data, size_of::<u32>(), "Ipv4Addr");
Ok(data.get_u32::<BigEndian>().into())
Ok(data.get_u32_be().into())
}
fn serialize(&self, _context: &mut DnsPacketWriteContext, packet: &mut Vec<u8>) -> Result<()> {
@ -78,7 +78,7 @@ impl DnsPacketData for Ipv6Addr {
#[cfg(test)]
mod tests {
use errors::*;
use crate::errors::*;
fn deserialize<T: super::DnsPacketData>(data: &'static [u8]) -> Result<T> {
use bytes::{Bytes,Buf};
@ -86,7 +86,7 @@ mod tests {
let mut c = Cursor::new(Bytes::from_static(data));
let result = T::deserialize(&mut c)?;
if c.remaining() != 0 {
bail!("data remaining: {}", c.remaining())
failure::bail!("data remaining: {}", c.remaining())
}
Ok(result)
}

View File

@ -1,6 +1,6 @@
use bytes::{BufMut, BigEndian};
use errors::*;
use common_types::name::{DnsName, DnsCompressedName, DnsLabelRef};
use bytes::{BufMut};
use crate::errors::*;
use crate::common_types::name::{DnsName, DnsCompressedName, DnsLabelRef};
// only points to uncompressed labels; if a label of a name is stored,
// all following labels must be stored too, even if their pos >= 0x4000.
@ -218,7 +218,7 @@ impl DnsPacketWriteContext {
let p = labels[e_ndx].pos;
debug_assert!(p < 0x4000);
packet.reserve(2);
packet.put_u16::<BigEndian>(0xc000 | p as u16);
packet.put_u16_be(0xc000 | p as u16);
},
None => {
// no suffix written already

View File

@ -1,14 +1,16 @@
use bytes::Bytes;
use common_types::{Class, Type, classes};
use errors::*;
use records::UnknownRecord;
use ser::packet::{DnsPacketData, DnsPacketWriteContext};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext};
use crate::common_types::{Class, Type, classes};
use crate::errors::*;
use crate::records::UnknownRecord;
use crate::ser::packet::{DnsPacketData, DnsPacketWriteContext};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext};
use std::any::Any;
use std::borrow::Cow;
use std::fmt;
use std::io::Cursor;
pub use dnsbox_derive::RRData;
pub trait RRDataPacket {
fn deserialize_rr_data(ttl: u32, rr_class: Class, rr_type: Type, data: &mut Cursor<Bytes>) -> Result<Self>
where
@ -22,9 +24,9 @@ pub trait RRDataPacket {
impl<T: DnsPacketData + StaticRRData> RRDataPacket for T {
fn deserialize_rr_data(_ttl: u32, rr_class: Class, rr_type: Type, data: &mut Cursor<Bytes>) -> Result<Self> {
ensure!(rr_type == T::TYPE, "type mismatch");
failure::ensure!(rr_type == T::TYPE, "type mismatch");
if T::CLASS != classes::ANY {
ensure!(rr_class == T::CLASS, "class mismatch: got {}, need {}", rr_class, T::CLASS);
failure::ensure!(rr_class == T::CLASS, "class mismatch: got {}, need {}", rr_class, T::CLASS);
}
T::deserialize(data)
}
@ -55,12 +57,12 @@ impl<T: DnsTextData + StaticRRData> RRDataText for T {
where
Self: Sized,
{
ensure!(context.record_type() == Some(T::TYPE), "type mismatch");
failure::ensure!(context.record_type() == Some(T::TYPE), "type mismatch");
let rr_class = context.zone_class().expect("require zone CLASS to parse record");
if T::CLASS != classes::ANY {
ensure!(rr_class == T::CLASS, "class mismatch: got {}, need {}", rr_class, T::CLASS);
failure::ensure!(rr_class == T::CLASS, "class mismatch: got {}, need {}", rr_class, T::CLASS);
}
ensure!(context.last_ttl().is_some(), "require TTL to parse record");
failure::ensure!(context.last_ttl().is_some(), "require TTL to parse record");
T::dns_parse(context, data)
}

View File

@ -1,16 +1,18 @@
use common_types;
use crate::common_types;
use std::fmt;
mod std_impls;
pub mod quoted;
pub use dnsbox_derive::DnsTextData;
pub fn skip_whitespace(data: &mut &str) {
*data = (*data).trim_start();
}
pub fn next_field<'a>(data: &mut &'a str) -> ::errors::Result<&'a str> {
pub fn next_field<'a>(data: &mut &'a str) -> crate::errors::Result<&'a str> {
*data = (*data).trim_start();
if data.is_empty() { bail!("missing field"); }
if data.is_empty() { failure::bail!("missing field"); }
match data.find(char::is_whitespace) {
None => {
let result = *data;
@ -25,9 +27,9 @@ pub fn next_field<'a>(data: &mut &'a str) -> ::errors::Result<&'a str> {
}
}
pub fn next_quoted_field(data: &mut &str) -> ::errors::Result<Vec<u8>> {
pub fn next_quoted_field(data: &mut &str) -> crate::errors::Result<Vec<u8>> {
*data = (*data).trim_start();
if data.is_empty() { bail!("missing field"); }
if data.is_empty() { failure::bail!("missing field"); }
let result = quoted::UnquoteIterator::new(data).collect::<Result<Vec<_>, _>>()?;
Ok(result)
@ -191,7 +193,7 @@ impl DnsTextContext {
}
pub trait DnsTextData {
fn dns_parse(context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self>
fn dns_parse(context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self>
where
Self: Sized,
;
@ -199,14 +201,14 @@ pub trait DnsTextData {
fn dns_format(&self, f: &mut DnsTextFormatter) -> fmt::Result;
}
pub fn parse_with<'a, F, O>(data: &'a str, parser: F) -> ::errors::Result<O>
pub fn parse_with<'a, F, O>(data: &'a str, parser: F) -> crate::errors::Result<O>
where
for<'b> F: FnOnce(&'b mut &'a str) -> ::errors::Result<O>,
for<'b> F: FnOnce(&'b mut &'a str) -> crate::errors::Result<O>,
{
let mut data = data;
let result = parser(&mut data)?;
let data = data.trim();
ensure!(data.is_empty(), "didn't parse complete text, remaining: {:?}", data);
failure::ensure!(data.is_empty(), "didn't parse complete text, remaining: {:?}", data);
Ok(result)
}

View File

@ -9,7 +9,7 @@ impl ::std::ops::Deref for EncodedByte {
type Target = str;
fn deref(&self) -> &Self::Target {
::unsafe_ops::from_utf8_unchecked(&self.storage[..self.used as usize])
crate::unsafe_ops::from_utf8_unchecked(&self.storage[..self.used as usize])
}
}
@ -78,7 +78,7 @@ impl fmt::Display for UnquoteError {
}
}
impl ::failure::Fail for UnquoteError {}
impl failure::Fail for UnquoteError {}
pub struct UnquoteIterator<'a, 'b: 'a> {
quoted: bool,
@ -191,7 +191,7 @@ impl<'a, 'b: 'a> Iterator for UnquoteIterator<'a, 'b> {
#[cfg(test)]
mod tests {
use ser::text::{next_quoted_field, quote};
use crate::ser::text::{next_quoted_field, quote};
fn check_quote(data: &[u8], quoted: &str) {
assert_eq!(

View File

@ -1,10 +1,10 @@
use std::fmt;
use std::net::{Ipv4Addr, Ipv6Addr};
use ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
use crate::ser::text::{DnsTextData, DnsTextFormatter, DnsTextContext, next_field};
/* only decimal representations are used for numbers */
impl DnsTextData for u8 {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
Ok(next_field(data)?.parse()?)
}
@ -14,7 +14,7 @@ impl DnsTextData for u8 {
}
impl DnsTextData for u16 {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
Ok(next_field(data)?.parse()?)
}
@ -24,7 +24,7 @@ impl DnsTextData for u16 {
}
impl DnsTextData for u32 {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
Ok(next_field(data)?.parse()?)
}
@ -35,7 +35,7 @@ impl DnsTextData for u32 {
/* only decimal representations are needed for octets */
impl DnsTextData for Ipv4Addr {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
Ok(next_field(data)?.parse()?)
}
@ -46,7 +46,7 @@ impl DnsTextData for Ipv4Addr {
/* representation as in RFC 3513: https://tools.ietf.org/html/rfc3513#section-2.2 */
impl DnsTextData for Ipv6Addr {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> ::errors::Result<Self> {
fn dns_parse(_context: &DnsTextContext, data: &mut &str) -> crate::errors::Result<Self> {
Ok(next_field(data)?.parse()?)
}
@ -59,12 +59,12 @@ impl DnsTextData for Ipv6Addr {
mod tests {
use super::*;
fn deserialize<T: DnsTextData>(data: &str) -> ::errors::Result<T> {
fn deserialize<T: DnsTextData>(data: &str) -> crate::errors::Result<T> {
let context = DnsTextContext::new();
let mut data = data;
let res = T::dns_parse(&context, &mut data)?;
let data = data.trim();
ensure!(data.is_empty(), "didn't read data completely");
failure::ensure!(data.is_empty(), "didn't read data completely");
Ok(res)
}

View File

@ -2,6 +2,7 @@
name = "dnsbox-derive"
version = "0.1.0"
authors = ["Stefan Bühler <stbuehler@web.de>"]
edition = "2018"
[lib]
proc-macro = true

View File

@ -41,16 +41,16 @@ pub fn build(ast: &syn::DeriveInput) -> quote::Tokens {
quote!{
impl ::dnsbox_base::ser::packet::DnsPacketData for #name {
#[allow(unused_imports)]
fn deserialize(_data: &mut ::std::io::Cursor<::dnsbox_base::bytes::Bytes>) -> ::dnsbox_base::errors::Result<Self> {
use ::dnsbox_base::failure::ResultExt;
use ::dnsbox_base::ser::packet::DnsPacketData;
fn deserialize(_data: &mut ::std::io::Cursor<::dnsbox_base::_bytes::Bytes>) -> ::dnsbox_base::errors::Result<Self> {
use dnsbox_base::_failure::ResultExt;
use dnsbox_base::ser::packet::DnsPacketData;
Ok(#name{ #parse_fields })
}
#[allow(unused_imports)]
fn serialize(&self, _context: &mut ::dnsbox_base::ser::packet::DnsPacketWriteContext, _packet: &mut Vec<u8>) -> ::dnsbox_base::errors::Result<()> {
use ::dnsbox_base::failure::ResultExt;
use ::dnsbox_base::ser::packet::DnsPacketData;
use dnsbox_base::_failure::ResultExt;
use dnsbox_base::ser::packet::DnsPacketData;
#serialize_fields
Ok(())
}

View File

@ -40,7 +40,7 @@ pub fn build(ast: &syn::DeriveInput) -> quote::Tokens {
#[allow(unused_imports)]
impl ::dnsbox_base::ser::text::DnsTextData for #name {
fn dns_parse(_context: &::dnsbox_base::ser::text::DnsTextContext, _data: &mut &str) -> ::dnsbox_base::errors::Result<Self> {
use dnsbox_base::failure::ResultExt;
use dnsbox_base::_failure::ResultExt;
use dnsbox_base::ser::text::DnsTextData;
Ok(#name{ #parse_fields })
}