Compare commits
83 Commits
Author | SHA1 | Date |
---|---|---|
Frank Denis | 91e3109831 | |
Aaron Gember-Jacobson | bdee525553 | |
Frank Denis | debdd9b9cc | |
xtr3me | 63fa457bae | |
Frank Denis | a2fa341679 | |
Frank Denis | 2efc655a6f | |
Frank Denis | 2d712d777d | |
dependabot-preview[bot] | f90d59f7a7 | |
Frank Denis | 007b76fdbd | |
bstrie | e3829405a7 | |
Frank Denis | dd08639f15 | |
Aloïs Micard | b5ea7d8fdd | |
Frank Denis | 16f4fd52cf | |
Frank Denis | 4512fa69a7 | |
Frank Denis | f344cf97c2 | |
Frank Denis | d8949d508c | |
Frank Denis | 85deb50eab | |
Frank Denis | 47d3f560e3 | |
Frank Denis | 5a6d3d0b02 | |
Frank Denis | 87b06ef77d | |
Frank Denis | b8ce201ae7 | |
dependabot-preview[bot] | 8e86fb02f2 | |
Frank Denis | da3ceb7e92 | |
Frank Denis | 4e9c11275c | |
Frank Denis | 0ddd4efb0e | |
dependabot-preview[bot] | ba42dd3742 | |
Frank Denis | ff4b312c3e | |
Frank Denis | 584b0ca9e7 | |
Frank Denis | 66fba5987a | |
Frank Denis | 32a804cd8d | |
dependabot-preview[bot] | 9c80aee3de | |
dependabot-preview[bot] | 9d46adc3e0 | |
Frank Denis | 3bf5aa5ec4 | |
Frank Denis | f943be0100 | |
Frank Denis | f339052e8c | |
Frank Denis | e854072dbb | |
Frank Denis | 1e4974b0d6 | |
Frank Denis | 775cd628e0 | |
Frank Denis | 60e4052d65 | |
Frank Denis | 39ee8bc5bd | |
Frank Denis | 3d75b1ab67 | |
Frank Denis | 2a4b785963 | |
Frank Denis | e46de6c05b | |
Frank Denis | 976d4f84ff | |
Frank Denis | c9127a27bf | |
Ilya Glotov | d0ac396e12 | |
Frank Denis | 4092f6d9fe | |
Frank Denis | 25a3d524de | |
Frank Denis | 81db1ff07b | |
Frank Denis | 1cb77d9323 | |
Ilya Glotov | 37966bd369 | |
Frank Denis | 5f8505d80d | |
Frank Denis | 70bab797dc | |
Frank Denis | 811c41e27e | |
Frank Denis | 4f9788847e | |
Frank Denis | ab403d9998 | |
Frank Denis | 51c944585f | |
Frank Denis | 06b34c0e39 | |
Frank Denis | 45ac24c589 | |
Frank Denis | 2f7aebf0e8 | |
Frank Denis | 9a9f0e29b7 | |
Frank Denis | 5dda861524 | |
Ilya Glotov | 79f0803fd5 | |
Ilya Glotov | c8d367c97f | |
Frank Denis | 5d350247b6 | |
Frank Denis | 25ecb8d1ad | |
Frank Denis | db603cd65d | |
Frank Denis | 627ab61ccf | |
Frank Denis | 77d07722a0 | |
Frank Denis | 7955d0d55a | |
Frank Denis | 3a36b3ac6e | |
Frank Denis | 2bab4b0afb | |
Frank Denis | f9d7237671 | |
Frank Denis | affc16b0ef | |
Frank Denis | 3762554903 | |
Frank Denis | b2d17e6458 | |
Adrien Gallouët | 6b1b675d47 | |
Frank Denis | 59e79d5259 | |
Frank Denis | 390204f479 | |
Frank Denis | b31f97163f | |
Frank Denis | f7d8e46752 | |
Frank Denis | ef3a57328e | |
Frank Denis | b1183810b8 |
|
@ -0,0 +1,8 @@
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: cargo
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
time: "04:00"
|
||||||
|
open-pull-requests-limit: 10
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: Rust
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --verbose
|
||||||
|
- name: Run tests
|
||||||
|
run: cargo test --verbose
|
|
@ -1,3 +1,3 @@
|
||||||
# Generated by Cargo
|
*~
|
||||||
# will have compiled files and executables
|
Cargo.lock
|
||||||
/target/
|
/target/
|
||||||
|
|
60
.travis.yml
60
.travis.yml
|
@ -1,60 +0,0 @@
|
||||||
language: rust
|
|
||||||
cache: cargo
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- PROJECT_NAME=iptoasn-webservice
|
|
||||||
- MAKE_DEB=yes
|
|
||||||
- DEB_MAINTAINER="Frank Denis <github@pureftpd.org>"
|
|
||||||
- DEB_DESCRIPTION="Webservice for the iptoasn.com database"
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: linux
|
|
||||||
rust: nightly
|
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
allow_failures:
|
|
||||||
# TODO You might need to allow failures for some target on some channel for some reason. Below
|
|
||||||
# there's one (commented out) example of how to do that. Just change the OS, channel and TARGET
|
|
||||||
# as needed.
|
|
||||||
# - os: linux
|
|
||||||
# rust: nightly
|
|
||||||
# env: TARGET=x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- export PATH="$PATH:$HOME/.cargo/bin"
|
|
||||||
|
|
||||||
install:
|
|
||||||
- bash ci/install.sh
|
|
||||||
|
|
||||||
script:
|
|
||||||
- bash ci/script.sh
|
|
||||||
|
|
||||||
before_deploy:
|
|
||||||
- bash ci/before_deploy.sh
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
provider: releases
|
|
||||||
api_key:
|
|
||||||
secure: 0Y8ZXOJaNJJ5/0IRcXyNIOJK4EICQDRtaB/E+pboNUchJn9fThGMQc2QtZaGddBNrnuHsftBFM7mWXJvZ2H9YGgbBl1N6Z2y33vawSPgzTnfz0CZRJfX1Gl6IdtDH9zvlblHI1aE4eJ6lAu0q8VQ874CBPxoIlzU9jArOTdvyPT+8t64Y0K240trfqrm0NHloUbZtm+HeRJqoK1RKE4kdrpESIVMyyq67fM9T0VqLg+x3OHeQ/itFnZpjqtVtj9WhZeKM6iTNLQT+vLpRAvq8w6sv1WeCMYAqdXUL7jQnVaI+MiepC9z8OoF0ZAYes0I+3aaNsgMHiuwkW+nDUcQp5XLDW3oCq/uST4pN2ki/AJPy4UUUx++xb8SgtKE4wzBGbT0u5yO9JkIPxJZRLy+E0IvTlqVEZL/tvnI09JQQmzgDdP1hCcxpxBBm4xLi/2qSHIJIMUbb92DRwOrTii34+C0oa1UZKh2P/ceCtLNOlOCmFAcWE9uAxjEGP903mmgbixj8xBbyuROedHIMxag0Jr9Tdoi0hsVdhOEss4JjNKf7ayjepRIw5lNFjxk+jgB+Om0J3vQ+i83LxX1a0b9YV+KJUtWz/CV43mwYhF+jh2GAMe0/cvNCbFT4au0SW2FKDvV/00AJ5tPGimVXNe0e+AUqjbJ2sRpylIQw1Mfl6Y=
|
|
||||||
file_glob: true
|
|
||||||
file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.*
|
|
||||||
# don't delete the artifacts from previous phases
|
|
||||||
skip_cleanup: true
|
|
||||||
# deploy when a new tag is pushed
|
|
||||||
on:
|
|
||||||
condition: $TRAVIS_RUST_VERSION = nightly
|
|
||||||
tags: true
|
|
||||||
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
# Pushes and PR to the master branch
|
|
||||||
- master
|
|
||||||
# IMPORTANT Ruby regex to match tags. Required, or travis won't trigger deploys when a new tag
|
|
||||||
# is pushed. This regex matches semantic versions like v1.2.3-rc4+2016.02.22
|
|
||||||
- /^\d+\.\d+\.\d+.*$/
|
|
||||||
|
|
||||||
notifications:
|
|
||||||
email:
|
|
||||||
on_success: change
|
|
|
@ -1,810 +0,0 @@
|
||||||
[root]
|
|
||||||
name = "iptoasn-webservice"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap 2.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"iron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"router 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"serde 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"serde_json 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-envlogger 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-stdlog 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-term 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "aho-corasick"
|
|
||||||
version = "0.5.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ansi_term"
|
|
||||||
version = "0.9.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitflags"
|
|
||||||
version = "0.7.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chrono"
|
|
||||||
version = "0.2.25"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"num 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap"
|
|
||||||
version = "2.16.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"strsim 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"term_size 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicode-width 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clippy"
|
|
||||||
version = "0.0.96"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"clippy_lints 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clippy_lints"
|
|
||||||
version = "0.0.96"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"regex-syntax 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "conduit-mime-types"
|
|
||||||
version = "0.7.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cookie"
|
|
||||||
version = "0.2.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"url 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam"
|
|
||||||
version = "0.2.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dtoa"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "error"
|
|
||||||
version = "0.1.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"traitobject 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "flate2"
|
|
||||||
version = "0.2.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gcc"
|
|
||||||
version = "0.3.38"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gdi32-sys"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hpack"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "httparse"
|
|
||||||
version = "1.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hyper"
|
|
||||||
version = "0.9.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"url 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "idna"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "iron"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"url 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "isatty"
|
|
||||||
version = "0.1.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)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "itoa"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "kernel32-sys"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "language-tags"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazy_static"
|
|
||||||
version = "0.1.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazy_static"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libc"
|
|
||||||
version = "0.2.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libressl-pnacl-sys"
|
|
||||||
version = "2.1.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "log"
|
|
||||||
version = "0.3.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "matches"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memchr"
|
|
||||||
version = "0.1.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "mime"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "miniz-sys"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "modifier"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nom"
|
|
||||||
version = "1.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num"
|
|
||||||
version = "0.1.36"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-integer"
|
|
||||||
version = "0.1.32"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-iter"
|
|
||||||
version = "0.1.32"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-traits"
|
|
||||||
version = "0.1.36"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num_cpus"
|
|
||||||
version = "0.2.13"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl"
|
|
||||||
version = "0.7.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl-sys"
|
|
||||||
version = "0.7.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl-sys-extras"
|
|
||||||
version = "0.7.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "openssl-verify"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pkg-config"
|
|
||||||
version = "0.3.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "plugin"
|
|
||||||
version = "0.2.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pnacl-build-helper"
|
|
||||||
version = "1.4.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "quine-mc_cluskey"
|
|
||||||
version = "0.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand"
|
|
||||||
version = "0.3.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex"
|
|
||||||
version = "0.1.79"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"regex-syntax 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-syntax"
|
|
||||||
version = "0.3.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "route-recognizer"
|
|
||||||
version = "0.1.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "router"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"iron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"route-recognizer 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"url 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc-serialize"
|
|
||||||
version = "0.3.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_version"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.1.20"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde"
|
|
||||||
version = "0.8.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "serde_json"
|
|
||||||
version = "0.8.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"serde 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slog"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slog-envlogger"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"regex 0.1.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-stdlog 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-term 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slog-extra"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"slog 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slog-stdlog"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-term 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slog-stream"
|
|
||||||
version = "1.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"slog 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-extra 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "slog-term"
|
|
||||||
version = "1.3.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"slog-stream 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "solicit"
|
|
||||||
version = "0.4.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strsim"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tempdir"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "term_size"
|
|
||||||
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)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thread-id"
|
|
||||||
version = "2.0.0"
|
|
||||||
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)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thread_local"
|
|
||||||
version = "0.2.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "time"
|
|
||||||
version = "0.1.35"
|
|
||||||
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)",
|
|
||||||
"libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "toml"
|
|
||||||
version = "0.1.30"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "traitobject"
|
|
||||||
version = "0.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "traitobject"
|
|
||||||
version = "0.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "typeable"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "typemap"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"unsafe-any 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicase"
|
|
||||||
version = "1.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-bidi"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-normalization"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-segmentation"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-width"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unsafe-any"
|
|
||||||
version = "0.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"traitobject 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "url"
|
|
||||||
version = "1.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "user32-sys"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "utf8-ranges"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "vec_map"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi"
|
|
||||||
version = "0.2.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-build"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66"
|
|
||||||
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
|
|
||||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
|
||||||
"checksum chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "9213f7cd7c27e95c2b57c49f0e69b1ea65b27138da84a170133fd21b07659c00"
|
|
||||||
"checksum clap 2.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = "08aac7b078ec0a58e1d4b43cfb11d47001f8eb7c6f6f2bda4f5eed43c82491f1"
|
|
||||||
"checksum clippy 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)" = "6eacf01b0aad84a0817703498f72d252df7c0faf6a5b86d0be4265f1829e459f"
|
|
||||||
"checksum clippy_lints 0.0.96 (registry+https://github.com/rust-lang/crates.io-index)" = "a49960c9aab544ce86b004dcb61620e8b898fea5fc0f697a028f460f48221ed6"
|
|
||||||
"checksum conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "95ca30253581af809925ef68c2641cc140d6183f43e12e0af4992d53768bd7b8"
|
|
||||||
"checksum cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e3d6405328b6edb412158b3b7710e2634e23f3614b9bb1c412df7952489a626"
|
|
||||||
"checksum crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0c5ea215664ca264da8a9d9c3be80d2eaf30923c259d03e870388eb927508f97"
|
|
||||||
"checksum dtoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0dd841b58510c9618291ffa448da2e4e0f699d984d436122372f446dae62263d"
|
|
||||||
"checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc"
|
|
||||||
"checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb"
|
|
||||||
"checksum gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "553f11439bdefe755bf366b264820f1da70f3aaf3924e594b886beb9c831bcf5"
|
|
||||||
"checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518"
|
|
||||||
"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58"
|
|
||||||
"checksum httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46534074dbb80b070d60a5cb8ecadd8963a00a438ae1a95268850a7ef73b67ae"
|
|
||||||
"checksum hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "eb27e8a3e8f17ac43ffa41bbda9cf5ad3f9f13ef66fa4873409d4902310275f7"
|
|
||||||
"checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11"
|
|
||||||
"checksum iron 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9fb1b2d809f84bf347e472d5758762b5c804e0c622970235f156d82673e4d334"
|
|
||||||
"checksum isatty 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7408a548dc0e406b7912d9f84c261cc533c1866e047644a811c133c56041ac0c"
|
|
||||||
"checksum itoa 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae3088ea4baeceb0284ee9eea42f591226e6beaecf65373e41b38d95a1b8e7a1"
|
|
||||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
|
||||||
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
|
|
||||||
"checksum lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "cf186d1a8aa5f5bee5fd662bc9c1b949e0259e1bcc379d1f006847b0080c7417"
|
|
||||||
"checksum lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "49247ec2a285bb3dcb23cbd9c35193c025e7251bfce77c1d5da97e6362dffe7f"
|
|
||||||
"checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8"
|
|
||||||
"checksum libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71"
|
|
||||||
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
|
|
||||||
"checksum matches 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc3ad8109fa4b522f9b0cd81440422781f564aaf8c195de6b9d6642177ad0dd"
|
|
||||||
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20"
|
|
||||||
"checksum mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5c93a4bd787ddc6e7833c519b73a50883deb5863d76d9b71eb8216fb7f94e66"
|
|
||||||
"checksum miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1f4d337a01c32e1f2122510fed46393d53ca35a7f429cb0450abaedfa3ed54"
|
|
||||||
"checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58"
|
|
||||||
"checksum nom 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce"
|
|
||||||
"checksum num 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "bde7c03b09e7c6a301ee81f6ddf66d7a28ec305699e3d3b056d2fc56470e3120"
|
|
||||||
"checksum num-integer 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "fb24d9bfb3f222010df27995441ded1e954f8f69cd35021f6bef02ca9552fb92"
|
|
||||||
"checksum num-iter 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "287a1c9969a847055e1122ec0ea7a5c5d6f72aad97934e131c83d5c08ab4e45c"
|
|
||||||
"checksum num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c"
|
|
||||||
"checksum num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3"
|
|
||||||
"checksum openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "c4117b6244aac42ed0150a6019b4d953d28247c5dd6ae6f46ae469b5f2318733"
|
|
||||||
"checksum openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "89c47ee94c352eea9ddaf8e364be7f978a3bb6d66d73176572484238dd5a5c3f"
|
|
||||||
"checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa"
|
|
||||||
"checksum openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed86cce894f6b0ed4572e21eb34026f1dc8869cb9ee3869029131bc8c3feb2d"
|
|
||||||
"checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa"
|
|
||||||
"checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0"
|
|
||||||
"checksum pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "61c9231d31aea845007443d62fcbb58bb6949ab9c18081ee1e09920e0cf1118b"
|
|
||||||
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
|
|
||||||
"checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5"
|
|
||||||
"checksum regex 0.1.79 (registry+https://github.com/rust-lang/crates.io-index)" = "33afc849c34c7e9389435f5f2ac9bb0cc5eb69f137e9aa6e6b1ef0b2baab0226"
|
|
||||||
"checksum regex-syntax 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "01acf14447f3e18588a1f42ac1402c6c66e2204210f70bd5b7b5903ba8ba01d3"
|
|
||||||
"checksum route-recognizer 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4f0a750d020adb1978f5964ea7bca830585899b09da7cbb3f04961fc2400122d"
|
|
||||||
"checksum router 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b94397bfa5b772b4375be4da12560a7c1c1e74b2e35c46ed312958aad56df726"
|
|
||||||
"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b"
|
|
||||||
"checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084"
|
|
||||||
"checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac"
|
|
||||||
"checksum semver 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d5b7638a1f03815d94e88cb3b3c08e87f0db4d683ef499d1836aaf70a45623f"
|
|
||||||
"checksum serde 0.8.16 (registry+https://github.com/rust-lang/crates.io-index)" = "1105e65d0a0b212d2d735c8b5a4f6aba2adc501e8ad4497e9f1a39e4c4ac943e"
|
|
||||||
"checksum serde_json 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1cb6b19e74d9f65b9d03343730b643d729a446b29376785cd65efdff4675e2fc"
|
|
||||||
"checksum slog 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9b9c18083fb1c248355784cf996783000e5eab2af74afcd0f3ec514a301f032"
|
|
||||||
"checksum slog-envlogger 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dfea715bb310c33c8f90e659bce5b95e39851348b9a7e2a77495a069662def78"
|
|
||||||
"checksum slog-extra 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f571614f815a4dc3aad7b9052d1e3eefd5ab76bb36efa90d4dc9ac134142b445"
|
|
||||||
"checksum slog-stdlog 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56cc08f40c45e0ab41dcfde0a19a22c5b7176d3827fc7d078450ebfdc080a37c"
|
|
||||||
"checksum slog-stream 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f0fee00b80a7a44f82c5cf44ba03b6dc2712f9c14469a62ad90ea0911635c5"
|
|
||||||
"checksum slog-term 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0ff8b2eecc800cdd59ba5cb10ed971416fe89fdaacfa3f36e2fc065666ef79ec"
|
|
||||||
"checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2"
|
|
||||||
"checksum strsim 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "50c069df92e4b01425a8bf3576d5d417943a6a7272fbabaf5bd80b1aaa76442e"
|
|
||||||
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
|
|
||||||
"checksum term_size 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f7f5f3f71b0040cecc71af239414c23fd3c73570f5ff54cf50e03cef637f2a0"
|
|
||||||
"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03"
|
|
||||||
"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5"
|
|
||||||
"checksum time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af"
|
|
||||||
"checksum toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "0590d72182e50e879c4da3b11c6488dae18fccb1ae0c7a3eda18e16795844796"
|
|
||||||
"checksum traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07eaeb7689bb7fca7ce15628319635758eda769fed481ecfe6686ddef2600616"
|
|
||||||
"checksum traitobject 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9dc23794ff47c95882da6f9d15de9a6be14987760a28cc0aafb40b7675ef09d8"
|
|
||||||
"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
|
|
||||||
"checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6"
|
|
||||||
"checksum unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764"
|
|
||||||
"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f"
|
|
||||||
"checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172"
|
|
||||||
"checksum unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b905d0fc2a1f0befd86b0e72e31d1787944efef9d38b9358a9e92a69757f7e3b"
|
|
||||||
"checksum unicode-width 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6722facc10989f63ee0e20a83cd4e1714a9ae11529403ac7e0afd069abc39e"
|
|
||||||
"checksum unsafe-any 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b351086021ebc264aea3ab4f94d61d889d98e5e9ec2d985d993f50133537fd3a"
|
|
||||||
"checksum url 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ba5a45db1d2e0effb7a1c00cc73ffc63a973da8c7d1fcd5b46f24285ade6c54"
|
|
||||||
"checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"
|
|
||||||
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
|
|
||||||
"checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f"
|
|
||||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
|
||||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
|
37
Cargo.toml
37
Cargo.toml
|
@ -1,22 +1,31 @@
|
||||||
[package]
|
[package]
|
||||||
name = "iptoasn-webservice"
|
name = "iptoasn-webservice"
|
||||||
version = "0.2.0"
|
description = "API server for iptoasn.com"
|
||||||
|
version = "0.2.5"
|
||||||
|
homepage = "https://iptoasn.com"
|
||||||
|
repository = "https://github.com/jedisct1/iptoasn-webservice"
|
||||||
|
keywords = ["ip", "asn", "bgp"]
|
||||||
|
license = "MIT"
|
||||||
authors = ["Frank Denis <github@pureftpd.org>"]
|
authors = ["Frank Denis <github@pureftpd.org>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "*"
|
clap = { version = "3.0.0", features = ["std", "cargo", "wrap_help"] }
|
||||||
flate2 = "*"
|
flate2 = "1"
|
||||||
hyper = "*"
|
horrorshow = "0.8"
|
||||||
iron = "*"
|
hyper = "0.10"
|
||||||
log = "*"
|
hyper-native-tls = "0.3"
|
||||||
router = "*"
|
iron = "0.6"
|
||||||
serde = "*"
|
log = "0.4"
|
||||||
serde_json = "*"
|
router = "0.6"
|
||||||
slog = "*"
|
serde_json = "1.0"
|
||||||
slog-envlogger = "*"
|
unicase = "1"
|
||||||
slog-stdlog = "*"
|
time = "0.1"
|
||||||
slog-term = "*"
|
|
||||||
clippy = {version = "*", optional = true}
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
lto = true
|
||||||
|
panic = "abort"
|
||||||
|
opt-level = 3
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
BSD 2-Clause License
|
BSD 2-Clause License
|
||||||
|
|
||||||
Copyright (c) 2016, Frank Denis
|
Copyright (c) 2016-2021, Frank Denis
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
|
![Build Status](https://github.com/jedisct1/iptoasn-webservice/workflows/Rust/badge.svg)
|
||||||
|
|
||||||
# iptoasn-webservice
|
# iptoasn-webservice
|
||||||
|
|
||||||
Webservice to map IP addresses to AS information.
|
Webservice to map IP addresses to AS information.
|
||||||
|
|
||||||
This is the source code of the public API from [iptoasn.com](https://iptoasn.com).
|
This is the source code of the public API from [iptoasn.com](https://iptoasn.com).
|
||||||
|
|
||||||
Requires [rust-nightly](https://www.rust-lang.org/).
|
Requires [rust](https://www.rust-lang.org/).
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ curl https://api.iptoasn.com/v1/as/ip/<ip address>
|
$ curl -H'Accept: application/json' https://api.iptoasn.com/v1/as/ip/<ip address>
|
||||||
```
|
```
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
@ -18,6 +20,7 @@ $ curl https://api.iptoasn.com/v1/as/ip/<ip address>
|
||||||
"as_description": "LEVEL3 - Level 3 Communications, Inc.",
|
"as_description": "LEVEL3 - Level 3 Communications, Inc.",
|
||||||
"as_number": 3356,
|
"as_number": 3356,
|
||||||
"first_ip": "4.0.0.0",
|
"first_ip": "4.0.0.0",
|
||||||
|
"ip": "4.3.2.1",
|
||||||
"last_ip": "4.23.87.255"
|
"last_ip": "4.23.87.255"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
# `before_deploy` phase: here we package the build artifacts
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
. $(dirname $0)/utils.sh
|
|
||||||
|
|
||||||
# Generate artifacts for release
|
|
||||||
mk_artifacts() {
|
|
||||||
cargo build --target $TARGET --release
|
|
||||||
}
|
|
||||||
|
|
||||||
mk_tarball() {
|
|
||||||
# create a "staging" directory
|
|
||||||
local td=$(mktempd)
|
|
||||||
local out_dir=$(pwd)
|
|
||||||
|
|
||||||
# TODO update this part to copy the artifacts that make sense for your project
|
|
||||||
# NOTE All Cargo build artifacts will be under the 'target/$TARGET/{debug,release}'
|
|
||||||
cp target/$TARGET/release/iptoasn_webservice $td
|
|
||||||
dostrip $td/iptoasn_webservice
|
|
||||||
|
|
||||||
pushd $td
|
|
||||||
|
|
||||||
# release tarball will look like 'rust-everywhere-v1.2.3-x86_64-unknown-linux-gnu.tar.gz'
|
|
||||||
tar czf $out_dir/${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.tar.gz *
|
|
||||||
|
|
||||||
popd
|
|
||||||
rm -r $td
|
|
||||||
}
|
|
||||||
|
|
||||||
# Package your artifacts in a .deb file
|
|
||||||
# NOTE right now you can only package binaries using the `dobin` command. Simply call
|
|
||||||
# `dobin [file..]` to include one or more binaries in your .deb package. I'll add more commands to
|
|
||||||
# install other things like manpages (`doman`) as the needs arise.
|
|
||||||
# XXX This .deb packaging is minimal -- just to make your app installable via `dpkg` -- and doesn't
|
|
||||||
# fully conform to Debian packaging guideliens (`lintian` raises a few warnings/errors)
|
|
||||||
mk_deb() {
|
|
||||||
# TODO update this part to package the artifacts that make sense for your project
|
|
||||||
dobin target/$TARGET/release/iptoasn_webservice
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
mk_artifacts
|
|
||||||
mk_tarball
|
|
||||||
|
|
||||||
if [ $TRAVIS_OS_NAME = linux ]; then
|
|
||||||
if [ ! -z $MAKE_DEB ]; then
|
|
||||||
dtd=$(mktempd)
|
|
||||||
mkdir -p $dtd/debian/usr/bin
|
|
||||||
|
|
||||||
mk_deb
|
|
||||||
|
|
||||||
mkdir -p $dtd/debian/DEBIAN
|
|
||||||
cat >$dtd/debian/DEBIAN/control <<EOF
|
|
||||||
Package: $PROJECT_NAME
|
|
||||||
Version: ${TRAVIS_TAG#v}
|
|
||||||
Architecture: $(architecture $TARGET)
|
|
||||||
Maintainer: $DEB_MAINTAINER
|
|
||||||
Description: $DEB_DESCRIPTION
|
|
||||||
EOF
|
|
||||||
|
|
||||||
fakeroot dpkg-deb --build $dtd/debian
|
|
||||||
mv $dtd/debian.deb $PROJECT_NAME-$TRAVIS_TAG-$TARGET.deb
|
|
||||||
rm -r $dtd
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
|
@ -1,60 +0,0 @@
|
||||||
# `install` phase: install stuff needed for the `script` phase
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
. $(dirname $0)/utils.sh
|
|
||||||
|
|
||||||
install_c_toolchain() {
|
|
||||||
case $TARGET in
|
|
||||||
aarch64-unknown-linux-gnu)
|
|
||||||
sudo apt-get install -y --no-install-recommends \
|
|
||||||
gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# For other targets, this is handled by addons.apt.packages in .travis.yml
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
install_rustup() {
|
|
||||||
# uninstall the rust toolchain installed by travis, we are going to use rustup
|
|
||||||
sh ~/rust/lib/rustlib/uninstall.sh
|
|
||||||
|
|
||||||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION
|
|
||||||
|
|
||||||
rustc -V
|
|
||||||
cargo -V
|
|
||||||
}
|
|
||||||
|
|
||||||
install_standard_crates() {
|
|
||||||
if [ $(host) != "$TARGET" ]; then
|
|
||||||
rustup target add $TARGET
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
configure_cargo() {
|
|
||||||
local prefix=$(gcc_prefix)
|
|
||||||
|
|
||||||
if [ ! -z $prefix ]; then
|
|
||||||
# information about the cross compiler
|
|
||||||
${prefix}gcc -v
|
|
||||||
|
|
||||||
# tell cargo which linker to use for cross compilation
|
|
||||||
mkdir -p .cargo
|
|
||||||
cat >>.cargo/config <<EOF
|
|
||||||
[target.$TARGET]
|
|
||||||
linker = "${prefix}gcc"
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
install_c_toolchain
|
|
||||||
install_rustup
|
|
||||||
install_standard_crates
|
|
||||||
configure_cargo
|
|
||||||
|
|
||||||
# TODO if you need to install extra stuff add it here
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
40
ci/script.sh
40
ci/script.sh
|
@ -1,40 +0,0 @@
|
||||||
# `script` phase: you usually build, test and generate docs in this phase
|
|
||||||
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
. $(dirname $0)/utils.sh
|
|
||||||
|
|
||||||
# TODO modify this function as you see fit
|
|
||||||
# PROTIP Always pass `--target $TARGET` to cargo commands, this makes cargo output build artifacts
|
|
||||||
# to target/$TARGET/{debug,release} which can reduce the number of needed conditionals in the
|
|
||||||
# `before_deploy`/packaging phase
|
|
||||||
run_test_suite() {
|
|
||||||
case $TARGET in
|
|
||||||
# configure emulation for transparent execution of foreign binaries
|
|
||||||
aarch64-unknown-linux-gnu)
|
|
||||||
export QEMU_LD_PREFIX=/usr/aarch64-linux-gnu
|
|
||||||
;;
|
|
||||||
arm*-unknown-linux-gnueabihf)
|
|
||||||
export QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ ! -z "$QEMU_LD_PREFIX" ]; then
|
|
||||||
# Run tests on a single thread when using QEMU user emulation
|
|
||||||
export RUST_TEST_THREADS=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cargo build --target $TARGET --verbose
|
|
||||||
cargo test --target $TARGET
|
|
||||||
|
|
||||||
# sanity check the file type
|
|
||||||
file target/$TARGET/debug/iptoasn_webservice
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
run_test_suite
|
|
||||||
}
|
|
||||||
|
|
||||||
main
|
|
71
ci/utils.sh
71
ci/utils.sh
|
@ -1,71 +0,0 @@
|
||||||
mktempd() {
|
|
||||||
echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
|
||||||
}
|
|
||||||
|
|
||||||
host() {
|
|
||||||
case "$TRAVIS_OS_NAME" in
|
|
||||||
linux)
|
|
||||||
echo x86_64-unknown-linux-gnu
|
|
||||||
;;
|
|
||||||
osx)
|
|
||||||
echo x86_64-apple-darwin
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
gcc_prefix() {
|
|
||||||
case "$TARGET" in
|
|
||||||
aarch64-unknown-linux-gnu)
|
|
||||||
echo aarch64-linux-gnu-
|
|
||||||
;;
|
|
||||||
arm*-gnueabihf)
|
|
||||||
echo arm-linux-gnueabihf-
|
|
||||||
;;
|
|
||||||
*-musl)
|
|
||||||
echo musl-
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
dostrip() {
|
|
||||||
local stu=strip prefix=$(gcc_prefix)
|
|
||||||
if which ${prefix}strip > /dev/null; then
|
|
||||||
stu=${prefix}strip
|
|
||||||
fi
|
|
||||||
if strip --version 2>/dev/null | fgrep GNU >/dev/null ; then
|
|
||||||
$stu -s $1
|
|
||||||
else
|
|
||||||
$stu $1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
dobin() {
|
|
||||||
[ -z $MAKE_DEB ] && die 'dobin: $MAKE_DEB not set'
|
|
||||||
[ $# -lt 1 ] && die "dobin: at least one argument needed"
|
|
||||||
|
|
||||||
local f prefix=$(gcc_prefix)
|
|
||||||
for f in "$@"; do
|
|
||||||
install -m0755 $f $dtd/debian/usr/bin/
|
|
||||||
dostrip $dtd/debian/usr/bin/$(basename $f)
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
architecture() {
|
|
||||||
case $1 in
|
|
||||||
x86_64-unknown-linux-gnu|x86_64-unknown-linux-musl)
|
|
||||||
echo amd64
|
|
||||||
;;
|
|
||||||
i686-unknown-linux-gnu|i686-unknown-linux-musl)
|
|
||||||
echo i386
|
|
||||||
;;
|
|
||||||
arm*-unknown-linux-gnueabihf)
|
|
||||||
echo armhf
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
die "architecture: unexpected target $TARGET"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
FROM alpine:3.17.7
|
||||||
|
|
||||||
|
COPY Cargo.* /tmp/iptoasn/
|
||||||
|
COPY src /tmp/iptoasn/src
|
||||||
|
|
||||||
|
WORKDIR /tmp/iptoasn
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache ca-certificates \
|
||||||
|
libressl \
|
||||||
|
llvm-libunwind \
|
||||||
|
libgcc \
|
||||||
|
&& apk add --no-cache --virtual .build-rust \
|
||||||
|
rust \
|
||||||
|
cargo \
|
||||||
|
libressl-dev \
|
||||||
|
\
|
||||||
|
&& cargo build --release \
|
||||||
|
&& strip target/release/iptoasn-webservice \
|
||||||
|
&& mv target/release/iptoasn-webservice /usr/bin/iptoasn-webservice \
|
||||||
|
&& adduser -D app \
|
||||||
|
\
|
||||||
|
&& apk del .build-rust \
|
||||||
|
&& rm -rf ~/.cargo \
|
||||||
|
/var/cache/apk/* \
|
||||||
|
/tmp/*
|
||||||
|
|
||||||
|
COPY docker/iptoasn-entrypoint.sh /iptoasn-entrypoint.sh
|
||||||
|
RUN chmod +x /iptoasn-entrypoint.sh
|
||||||
|
|
||||||
|
USER app
|
||||||
|
|
||||||
|
ENTRYPOINT ["/iptoasn-entrypoint.sh"]
|
|
@ -0,0 +1,36 @@
|
||||||
|
# How to use
|
||||||
|
|
||||||
|
Assume you are in the repo's root folder:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker build -t iptoasn -f docker/Dockerfile .
|
||||||
|
docker run -itd \
|
||||||
|
--name my-iptoasn \
|
||||||
|
-p 80:53661 \
|
||||||
|
iptoasn
|
||||||
|
```
|
||||||
|
|
||||||
|
Wait while iptoasn is downloading data, and then you can do `curl` requests as you used to:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
curl 127.0.0.1:80/v1/as/ip/8.8.8.8
|
||||||
|
```
|
||||||
|
|
||||||
|
## Setting service parameters
|
||||||
|
|
||||||
|
Listen port and database URL can be specified by environment variables:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -itd \
|
||||||
|
--name my-iptoasn \
|
||||||
|
-e IPTOASN_PORT=10000 \
|
||||||
|
-e IPTOASN_DBURL='http://your-database-url.com' \
|
||||||
|
-p 80:10000 \
|
||||||
|
iptoasn
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use as a binary
|
||||||
|
|
||||||
|
```sh
|
||||||
|
docker run -it --rm iptoasn --help
|
||||||
|
```
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DEFAULT_PORT='53661'
|
||||||
|
DEFAULT_DBURL='https://iptoasn.com/data/ip2asn-combined.tsv.gz'
|
||||||
|
|
||||||
|
if [ $IPTOASN_PORT ] || [ $IPTOASN_DBURL]; then
|
||||||
|
if ! [ $IPTOASN_PORT ]; then
|
||||||
|
IPTOASN_PORT=$DEFAULT_PORT
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ $IPTOASN_DBURL ]; then
|
||||||
|
IPTOASN_DBURL=$DEFAULT_DBURL
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec /usr/bin/iptoasn-webservice --listen 0.0.0.0:"$IPTOASN_PORT" --dburl "$IPTOASN_DBURL"
|
||||||
|
else
|
||||||
|
exec /usr/bin/iptoasn-webservice $@
|
||||||
|
fi
|
28
src/asns.rs
28
src/asns.rs
|
@ -1,10 +1,12 @@
|
||||||
use flate2::read::GzDecoder;
|
use flate2::read::GzDecoder;
|
||||||
use hyper::{self, client};
|
use hyper::net::HttpsConnector;
|
||||||
use std::cmp::{Eq, PartialOrd, PartialEq, Ord, Ordering};
|
use hyper::{self, Client};
|
||||||
use std::collections::Bound::{Included, Unbounded};
|
use hyper_native_tls::NativeTlsClient;
|
||||||
|
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
|
use std::ops::Bound::{Included, Unbounded};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -55,7 +57,9 @@ pub struct ASNs {
|
||||||
impl ASNs {
|
impl ASNs {
|
||||||
pub fn new(url: &str) -> Result<ASNs, &'static str> {
|
pub fn new(url: &str) -> Result<ASNs, &'static str> {
|
||||||
info!("Loading the database");
|
info!("Loading the database");
|
||||||
let client = client::Client::new();
|
let tls = NativeTlsClient::new().unwrap();
|
||||||
|
let connector = HttpsConnector::new(tls);
|
||||||
|
let client = Client::with_connector(connector);
|
||||||
let res = client.get(url).send().unwrap();
|
let res = client.get(url).send().unwrap();
|
||||||
if res.status != hyper::Ok {
|
if res.status != hyper::Ok {
|
||||||
error!("Unable to load the database");
|
error!("Unable to load the database");
|
||||||
|
@ -63,7 +67,7 @@ impl ASNs {
|
||||||
}
|
}
|
||||||
assert_eq!(res.status, hyper::Ok);
|
assert_eq!(res.status, hyper::Ok);
|
||||||
let mut data = String::new();
|
let mut data = String::new();
|
||||||
GzDecoder::new(res).unwrap().read_to_string(&mut data).unwrap();
|
GzDecoder::new(res).read_to_string(&mut data).unwrap();
|
||||||
let mut asns = BTreeSet::new();
|
let mut asns = BTreeSet::new();
|
||||||
for line in data.split_terminator('\n') {
|
for line in data.split_terminator('\n') {
|
||||||
let mut parts = line.split('\t');
|
let mut parts = line.split('\t');
|
||||||
|
@ -73,21 +77,21 @@ impl ASNs {
|
||||||
let country = parts.next().unwrap().to_owned();
|
let country = parts.next().unwrap().to_owned();
|
||||||
let description = parts.next().unwrap().to_owned();
|
let description = parts.next().unwrap().to_owned();
|
||||||
let asn = ASN {
|
let asn = ASN {
|
||||||
first_ip: first_ip,
|
first_ip,
|
||||||
last_ip: last_ip,
|
last_ip,
|
||||||
number: number,
|
number,
|
||||||
country: country,
|
country,
|
||||||
description: description,
|
description,
|
||||||
};
|
};
|
||||||
asns.insert(asn);
|
asns.insert(asn);
|
||||||
}
|
}
|
||||||
info!("Database loaded");
|
info!("Database loaded");
|
||||||
Ok(ASNs { asns: asns })
|
Ok(ASNs { asns })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn lookup_by_ip(&self, ip: IpAddr) -> Option<&ASN> {
|
pub fn lookup_by_ip(&self, ip: IpAddr) -> Option<&ASN> {
|
||||||
let fasn = ASN::from_single_ip(ip);
|
let fasn = ASN::from_single_ip(ip);
|
||||||
match self.asns.range(Unbounded, Included(&fasn)).next_back() {
|
match self.asns.range((Unbounded, Included(&fasn))).next_back() {
|
||||||
Some(found) if ip <= found.last_ip && found.number > 0 => Some(found),
|
Some(found) if ip <= found.last_ip && found.number > 0 => Some(found),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|
86
src/main.rs
86
src/main.rs
|
@ -1,45 +1,21 @@
|
||||||
#![cfg_attr(feature="clippy", feature(plugin))]
|
|
||||||
#![cfg_attr(feature="clippy", plugin(clippy))]
|
|
||||||
#![feature(btree_range, collections_bound)]
|
|
||||||
|
|
||||||
extern crate clap;
|
|
||||||
extern crate flate2;
|
|
||||||
extern crate iron;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate router;
|
extern crate horrorshow;
|
||||||
extern crate hyper;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
extern crate serde;
|
#[macro_use]
|
||||||
extern crate serde_json;
|
extern crate router;
|
||||||
#[macro_use(slog_error, slog_info, slog_trace, slog_log, o)]
|
#[macro_use]
|
||||||
extern crate slog;
|
extern crate clap;
|
||||||
|
|
||||||
mod asns;
|
mod asns;
|
||||||
mod webservice;
|
mod webservice;
|
||||||
|
|
||||||
use asns::*;
|
use crate::asns::*;
|
||||||
use clap::{Arg, App};
|
use crate::webservice::*;
|
||||||
|
use clap::Arg;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use webservice::*;
|
|
||||||
|
|
||||||
fn logger_init() {
|
|
||||||
extern crate slog_term;
|
|
||||||
extern crate slog_stdlog;
|
|
||||||
extern crate slog_envlogger;
|
|
||||||
|
|
||||||
use slog::DrainExt;
|
|
||||||
|
|
||||||
let drain = slog_envlogger::new(slog_term::streamer().build());
|
|
||||||
let root_logger = slog::Logger::root(drain.fuse(),
|
|
||||||
o!("place" => move |info: &slog::Record| {
|
|
||||||
format!("{}:{} {}",
|
|
||||||
info.file(), info.line(), info.module()
|
|
||||||
)}));
|
|
||||||
slog_stdlog::set_logger(root_logger.clone()).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_asns(db_url: &str) -> Result<ASNs, &'static str> {
|
fn get_asns(db_url: &str) -> Result<ASNs, &'static str> {
|
||||||
info!("Retrieving ASNs");
|
info!("Retrieving ASNs");
|
||||||
|
@ -60,36 +36,34 @@ fn update_asns(asns_arc: &Arc<RwLock<Arc<ASNs>>>, db_url: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
logger_init();
|
let matches = app_from_crate!()
|
||||||
let matches = App::new("iptoasn webservice")
|
.arg(
|
||||||
.version("0.2.0")
|
Arg::new("listen_addr")
|
||||||
.author("Frank Denis")
|
.short('l')
|
||||||
.about("Webservice for https://iptoasn.com")
|
.long("listen")
|
||||||
.arg(Arg::with_name("listen_addr")
|
.value_name("ip:port")
|
||||||
.short("l")
|
.help("Webservice IP and port")
|
||||||
.long("listen")
|
.takes_value(true)
|
||||||
.value_name("ip:port")
|
.default_value("0.0.0.0:53661"),
|
||||||
.help("Webservice IP and port")
|
)
|
||||||
.takes_value(true)
|
.arg(
|
||||||
.default_value("0.0.0.0:53661"))
|
Arg::new("db_url")
|
||||||
.arg(Arg::with_name("db_url")
|
.short('u')
|
||||||
.short("u")
|
.long("dburl")
|
||||||
.long("dburl")
|
.value_name("url")
|
||||||
.value_name("url")
|
.help("URL of the gzipped database")
|
||||||
.help("URL of the gzipped database")
|
.takes_value(true)
|
||||||
.takes_value(true)
|
.default_value("https://iptoasn.com/data/ip2asn-combined.tsv.gz"),
|
||||||
.default_value("https://iptoasn.com/data/ip2asn-combined.tsv.gz"))
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
let db_url = matches.value_of("db_url").unwrap().to_owned();
|
let db_url = matches.value_of("db_url").unwrap().to_owned();
|
||||||
let listen_addr = matches.value_of("listen_addr").unwrap();
|
let listen_addr = matches.value_of("listen_addr").unwrap();
|
||||||
let asns = get_asns(&db_url).expect("Unable to load the initial database");
|
let asns = get_asns(&db_url).expect("Unable to load the initial database");
|
||||||
let asns_arc = Arc::new(RwLock::new(Arc::new(asns)));
|
let asns_arc = Arc::new(RwLock::new(Arc::new(asns)));
|
||||||
let asns_arc_copy = asns_arc.clone();
|
let asns_arc_copy = asns_arc.clone();
|
||||||
thread::spawn(move || {
|
thread::spawn(move || loop {
|
||||||
loop {
|
thread::sleep(Duration::from_secs(3600));
|
||||||
thread::sleep(Duration::from_secs(3600));
|
update_asns(&asns_arc_copy, &db_url);
|
||||||
update_asns(&asns_arc_copy, &db_url);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
info!("Starting the webservice");
|
info!("Starting the webservice");
|
||||||
WebService::start(asns_arc, listen_addr);
|
WebService::start(asns_arc, listen_addr);
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
use asns::*;
|
use crate::asns::*;
|
||||||
use iron::{BeforeMiddleware, typemap};
|
use horrorshow::prelude::*;
|
||||||
use iron::headers::{CacheControl, CacheDirective};
|
use iron::headers::{Accept, CacheControl, CacheDirective, Expires, HttpDate, Vary};
|
||||||
use iron::mime::*;
|
use iron::mime::*;
|
||||||
use iron::modifiers::Header;
|
use iron::modifiers::Header;
|
||||||
use iron::prelude::*;
|
use iron::prelude::*;
|
||||||
use iron::status;
|
use iron::status;
|
||||||
|
use iron::{typemap, BeforeMiddleware};
|
||||||
use router::Router;
|
use router::Router;
|
||||||
use serde_json;
|
|
||||||
use std::net::IpAddr;
|
use std::net::IpAddr;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::sync::{Arc, RwLock};
|
use std::sync::{Arc, RwLock};
|
||||||
|
use time::{self, Duration};
|
||||||
|
use unicase::UniCase;
|
||||||
|
|
||||||
const TTL: u32 = 86400;
|
const TTL: u32 = 86_400;
|
||||||
|
|
||||||
struct ASNsMiddleware {
|
struct ASNsMiddleware {
|
||||||
asns_arc: Arc<RwLock<Arc<ASNs>>>,
|
asns_arc: Arc<RwLock<Arc<ASNs>>>,
|
||||||
|
@ -23,82 +26,252 @@ impl typemap::Key for ASNsMiddleware {
|
||||||
|
|
||||||
impl ASNsMiddleware {
|
impl ASNsMiddleware {
|
||||||
fn new(asns_arc: Arc<RwLock<Arc<ASNs>>>) -> ASNsMiddleware {
|
fn new(asns_arc: Arc<RwLock<Arc<ASNs>>>) -> ASNsMiddleware {
|
||||||
ASNsMiddleware { asns_arc: asns_arc }
|
ASNsMiddleware { asns_arc }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BeforeMiddleware for ASNsMiddleware {
|
impl BeforeMiddleware for ASNsMiddleware {
|
||||||
fn before(&self, req: &mut Request) -> IronResult<()> {
|
fn before(&self, req: &mut Request<'_, '_>) -> IronResult<()> {
|
||||||
req.extensions.insert::<ASNsMiddleware>(self.asns_arc.read().unwrap().clone());
|
req.extensions
|
||||||
|
.insert::<ASNsMiddleware>(self.asns_arc.read().unwrap().clone());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum OutputType {
|
||||||
|
Json,
|
||||||
|
Html,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct WebService;
|
pub struct WebService;
|
||||||
|
|
||||||
impl WebService {
|
impl WebService {
|
||||||
fn index(_: &mut Request) -> IronResult<Response> {
|
fn index(_: &mut Request<'_, '_>) -> IronResult<Response> {
|
||||||
Ok(Response::with((status::Ok,
|
Ok(Response::with((
|
||||||
Mime(TopLevel::Text,
|
status::Ok,
|
||||||
SubLevel::Plain,
|
Mime(
|
||||||
vec![(Attr::Charset, Value::Utf8)]),
|
TopLevel::Text,
|
||||||
Header(CacheControl(vec![CacheDirective::Public,
|
SubLevel::Plain,
|
||||||
CacheDirective::MaxAge(TTL)])),
|
vec![(Attr::Charset, Value::Utf8)],
|
||||||
"See https://iptoasn.com")))
|
),
|
||||||
|
Header(CacheControl(vec![
|
||||||
|
CacheDirective::Public,
|
||||||
|
CacheDirective::MaxAge(TTL),
|
||||||
|
])),
|
||||||
|
Header(Expires(HttpDate(
|
||||||
|
time::now() + Duration::seconds(TTL.into()),
|
||||||
|
))),
|
||||||
|
"See https://iptoasn.com",
|
||||||
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ip_lookup(req: &mut Request) -> IronResult<Response> {
|
fn accept_type(req: &Request<'_, '_>) -> OutputType {
|
||||||
let mime_text = Mime(TopLevel::Text,
|
let mut output_type = OutputType::Json;
|
||||||
SubLevel::Plain,
|
if let Some(header_accept) = req.headers.get::<Accept>() {
|
||||||
vec![(Attr::Charset, Value::Utf8)]);
|
for header in header_accept.iter() {
|
||||||
let mime_json = Mime(TopLevel::Application,
|
match header.item {
|
||||||
SubLevel::Json,
|
Mime(TopLevel::Text, SubLevel::Html, _) => {
|
||||||
vec![(Attr::Charset, Value::Utf8)]);
|
output_type = OutputType::Html;
|
||||||
let cache_header = Header(CacheControl(vec![CacheDirective::Public,
|
break;
|
||||||
CacheDirective::MaxAge(TTL)]));
|
}
|
||||||
|
Mime(_, SubLevel::Json, _) => {
|
||||||
|
output_type = OutputType::Json;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
output_type
|
||||||
|
}
|
||||||
|
|
||||||
|
fn output_json(
|
||||||
|
map: &serde_json::Map<String, serde_json::value::Value>,
|
||||||
|
cache_headers: (Header<CacheControl>, Header<Expires>),
|
||||||
|
vary_header: Header<Vary>,
|
||||||
|
) -> IronResult<Response> {
|
||||||
|
let json = serde_json::to_string(&map).unwrap();
|
||||||
|
let mime_json = Mime(
|
||||||
|
TopLevel::Application,
|
||||||
|
SubLevel::Json,
|
||||||
|
vec![(Attr::Charset, Value::Utf8)],
|
||||||
|
);
|
||||||
|
Ok(Response::with((
|
||||||
|
status::Ok,
|
||||||
|
mime_json,
|
||||||
|
cache_headers.0,
|
||||||
|
cache_headers.1,
|
||||||
|
vary_header,
|
||||||
|
json,
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn output_html(
|
||||||
|
map: &serde_json::Map<String, serde_json::value::Value>,
|
||||||
|
cache_headers: (Header<CacheControl>, Header<Expires>),
|
||||||
|
vary_header: Header<Vary>,
|
||||||
|
) -> IronResult<Response> {
|
||||||
|
let mime_html = Mime(
|
||||||
|
TopLevel::Text,
|
||||||
|
SubLevel::Html,
|
||||||
|
vec![(Attr::Charset, Value::Utf8)],
|
||||||
|
);
|
||||||
|
let html = html!{
|
||||||
|
head {
|
||||||
|
title { : "iptoasn lookup" }
|
||||||
|
meta(name="viewport", content="width=device-widthinitial-scale=1");
|
||||||
|
link(rel="stylesheet", href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css", integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi", crossorigin="anonymous");
|
||||||
|
style {
|
||||||
|
: "body { margin: 1em 4em }"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
body(class="container-fluid") {
|
||||||
|
header {
|
||||||
|
h1 { : format_args!("Information for IP address: {}", map.get("ip").unwrap().as_str().unwrap()) }
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
tr {
|
||||||
|
th { : "Announced" }
|
||||||
|
td { : format_args!("{}", if map.get("announced")
|
||||||
|
.unwrap().as_bool().unwrap() { "Yes" } else { "No" }) }
|
||||||
|
}
|
||||||
|
@ if map.get("announced").unwrap().as_bool().unwrap() {
|
||||||
|
tr {
|
||||||
|
th { : "First IP" }
|
||||||
|
td { : format_args!("{}", map.get("first_ip")
|
||||||
|
.unwrap().as_str().unwrap()) }
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
th { : "Last IP" }
|
||||||
|
td { : format_args!("{}", map.get("last_ip")
|
||||||
|
.unwrap().as_str().unwrap()) }
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
th { : "AS Number" }
|
||||||
|
td { : format_args!("{}", map.get("as_number")
|
||||||
|
.unwrap().as_u64().unwrap()) }
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
th { : "AS Country code" }
|
||||||
|
td { : format_args!("{}", map.get("as_country_code")
|
||||||
|
.unwrap().as_str().unwrap()) }
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
th { : "AS Description" }
|
||||||
|
td { : format_args!("{}", map.get("as_description")
|
||||||
|
.unwrap().as_str().unwrap()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.into_string()
|
||||||
|
.unwrap();
|
||||||
|
let html = format!("<!DOCTYPE html>\n<html>{}</html>", html);
|
||||||
|
Ok(Response::with((
|
||||||
|
status::Ok,
|
||||||
|
mime_html,
|
||||||
|
cache_headers.0,
|
||||||
|
cache_headers.1,
|
||||||
|
vary_header,
|
||||||
|
html,
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn output(
|
||||||
|
output_type: &OutputType,
|
||||||
|
map: &serde_json::Map<String, serde_json::value::Value>,
|
||||||
|
cache_headers: (Header<CacheControl>, Header<Expires>),
|
||||||
|
vary_header: Header<Vary>,
|
||||||
|
) -> IronResult<Response> {
|
||||||
|
match *output_type {
|
||||||
|
OutputType::Json => Self::output_json(map, cache_headers, vary_header),
|
||||||
|
_ => Self::output_html(map, cache_headers, vary_header),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ip_lookup(req: &mut Request<'_, '_>) -> IronResult<Response> {
|
||||||
|
let mime_text = Mime(
|
||||||
|
TopLevel::Text,
|
||||||
|
SubLevel::Plain,
|
||||||
|
vec![(Attr::Charset, Value::Utf8)],
|
||||||
|
);
|
||||||
|
let cache_headers = (
|
||||||
|
Header(CacheControl(vec![
|
||||||
|
CacheDirective::Public,
|
||||||
|
CacheDirective::MaxAge(TTL),
|
||||||
|
])),
|
||||||
|
Header(Expires(HttpDate(
|
||||||
|
time::now() + Duration::seconds(TTL.into()),
|
||||||
|
))),
|
||||||
|
);
|
||||||
|
let vary_header = Header(Vary::Items(vec![
|
||||||
|
UniCase::from_str("accept-encoding").unwrap(),
|
||||||
|
UniCase::from_str("accept").unwrap(),
|
||||||
|
]));
|
||||||
let ip_str = match req.extensions.get::<Router>().unwrap().find("ip") {
|
let ip_str = match req.extensions.get::<Router>().unwrap().find("ip") {
|
||||||
None => {
|
None => {
|
||||||
let response = Response::with((status::BadRequest,
|
let response = Response::with((
|
||||||
mime_text,
|
status::BadRequest,
|
||||||
cache_header,
|
mime_text,
|
||||||
"Missing IP address"));
|
cache_headers,
|
||||||
|
"Missing IP address",
|
||||||
|
));
|
||||||
return Ok(response);
|
return Ok(response);
|
||||||
}
|
}
|
||||||
Some(ip_str) => ip_str,
|
Some(ip_str) => ip_str,
|
||||||
};
|
};
|
||||||
let ip = match IpAddr::from_str(ip_str) {
|
let ip = match IpAddr::from_str(ip_str) {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
return Ok(Response::with((status::BadRequest,
|
return Ok(Response::with((
|
||||||
mime_text,
|
status::BadRequest,
|
||||||
cache_header,
|
mime_text,
|
||||||
"Invalid IP address")));
|
cache_headers,
|
||||||
|
"Invalid IP address",
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
Ok(ip) => ip,
|
Ok(ip) => ip,
|
||||||
};
|
};
|
||||||
let asns = req.extensions.get::<ASNsMiddleware>().unwrap();
|
let asns = req.extensions.get::<ASNsMiddleware>().unwrap();
|
||||||
|
let mut map = serde_json::Map::new();
|
||||||
|
map.insert(
|
||||||
|
"ip".to_string(),
|
||||||
|
serde_json::value::Value::String(ip_str.to_string()),
|
||||||
|
);
|
||||||
let found = match asns.lookup_by_ip(ip) {
|
let found = match asns.lookup_by_ip(ip) {
|
||||||
None => {
|
None => {
|
||||||
let mut map = serde_json::Map::new();
|
map.insert(
|
||||||
map.insert("announced", serde_json::value::Value::Bool(false));
|
"announced".to_string(),
|
||||||
let json = serde_json::to_string(&map).unwrap();
|
serde_json::value::Value::Bool(false),
|
||||||
return Ok(Response::with((status::Ok, mime_json, cache_header, json)));
|
);
|
||||||
|
return Self::output(&Self::accept_type(req), &map, cache_headers, vary_header);
|
||||||
}
|
}
|
||||||
Some(found) => found,
|
Some(found) => found,
|
||||||
};
|
};
|
||||||
let mut map = serde_json::Map::new();
|
map.insert(
|
||||||
map.insert("announced", serde_json::value::Value::Bool(true));
|
"announced".to_string(),
|
||||||
map.insert("first_ip",
|
serde_json::value::Value::Bool(true),
|
||||||
serde_json::value::Value::String(found.first_ip.to_string()));
|
);
|
||||||
map.insert("last_ip",
|
map.insert(
|
||||||
serde_json::value::Value::String(found.last_ip.to_string()));
|
"first_ip".to_string(),
|
||||||
map.insert("as_number",
|
serde_json::value::Value::String(found.first_ip.to_string()),
|
||||||
serde_json::value::Value::U64(found.number as u64));
|
);
|
||||||
map.insert("as_country_code",
|
map.insert(
|
||||||
serde_json::value::Value::String(found.country.clone()));
|
"last_ip".to_string(),
|
||||||
map.insert("as_description",
|
serde_json::value::Value::String(found.last_ip.to_string()),
|
||||||
serde_json::value::Value::String(found.description.clone()));
|
);
|
||||||
let json = serde_json::to_string(&map).unwrap();
|
map.insert(
|
||||||
Ok(Response::with((status::Ok, mime_json, cache_header, json)))
|
"as_number".to_string(),
|
||||||
|
serde_json::value::Value::Number(serde_json::Number::from(found.number)),
|
||||||
|
);
|
||||||
|
map.insert(
|
||||||
|
"as_country_code".to_string(),
|
||||||
|
serde_json::value::Value::String(found.country.clone()),
|
||||||
|
);
|
||||||
|
map.insert(
|
||||||
|
"as_description".to_string(),
|
||||||
|
serde_json::value::Value::String(found.description.clone()),
|
||||||
|
);
|
||||||
|
Self::output(&Self::accept_type(req), &map, cache_headers, vary_header)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn start(asns_arc: Arc<RwLock<Arc<ASNs>>>, listen_addr: &str) {
|
pub fn start(asns_arc: Arc<RwLock<Arc<ASNs>>>, listen_addr: &str) {
|
||||||
|
|
Loading…
Reference in New Issue