Compare commits

...

83 Commits

Author SHA1 Message Date
Frank Denis 91e3109831
Merge pull request #70 from agember/master
Update Alpine image version to support Rust version requirement
2024-03-05 21:26:34 +01:00
Aaron Gember-Jacobson bdee525553 Update Alpine image version to support Rust version requirement 2024-03-05 19:42:42 +00:00
Frank Denis debdd9b9cc
Merge pull request #37 from xtr3me/master
Update Alpine to fix Cargo issue caused by textwrap
2022-09-21 12:17:35 +02:00
xtr3me 63fa457bae
Update Alpine to fix Cargo issue caused by textwrap 2022-09-21 12:04:40 +02:00
Frank Denis a2fa341679 Clap update 2022-01-03 10:15:15 +01:00
Frank Denis 2efc655a6f Remove unneeded import 2021-10-21 15:47:30 +02:00
Frank Denis 2d712d777d
Merge pull request #31 from jedisct1/dependabot/add-v2-config-file
Upgrade to GitHub-native Dependabot
2021-04-30 16:05:53 +02:00
dependabot-preview[bot] f90d59f7a7
Upgrade to GitHub-native Dependabot 2021-04-29 20:50:32 +00:00
Frank Denis 007b76fdbd
Merge pull request #30 from bstrie/master
Replace deprecated collections::Bound with ops::Bound
2021-03-18 23:26:10 +01:00
bstrie e3829405a7 Replace deprecated collections::Bound with ops::Bound 2021-03-18 17:48:14 -04:00
Frank Denis dd08639f15
Merge pull request #29 from creekorful/fix-alpine-version
docker: fix alpine version
2021-02-05 15:16:18 +01:00
Aloïs Micard b5ea7d8fdd
docker: fix alpine version 2021-02-05 15:09:56 +01:00
Frank Denis 16f4fd52cf Merge branch 'master' of github.com:jedisct1/iptoasn-webservice
* 'master' of github.com:jedisct1/iptoasn-webservice:
  Create ci.yml
2021-01-03 09:58:08 +01:00
Frank Denis 4512fa69a7 Update badge 2021-01-03 09:57:58 +01:00
Frank Denis f344cf97c2
Create ci.yml 2021-01-03 09:56:47 +01:00
Frank Denis d8949d508c Remove Travis 2021-01-03 09:55:57 +01:00
Frank Denis 85deb50eab Don't use a very old alpine linux version 2021-01-03 09:55:38 +01:00
Frank Denis 47d3f560e3 y++ 2021-01-03 09:53:47 +01:00
Frank Denis 5a6d3d0b02 Use clap app_from_crate 2020-08-01 17:37:58 +02:00
Frank Denis 87b06ef77d Bump 2020-08-01 17:34:17 +02:00
Frank Denis b8ce201ae7 Move back to time 0.1, due to hyper 0.10 2020-08-01 17:33:29 +02:00
dependabot-preview[bot] 8e86fb02f2
Update time requirement from 0.1 to 0.2
Updates the requirements on [time](https://github.com/time-rs/time) to permit the latest version.
- [Release notes](https://github.com/time-rs/time/releases)
- [Commits](https://github.com/time-rs/time/compare/0.1.35...v0.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-20 04:59:47 +00:00
Frank Denis da3ceb7e92 Update .gitignore 2019-12-04 16:42:00 +01:00
Frank Denis 4e9c11275c Merge branch 'master' of github.com:jedisct1/iptoasn-webservice
* 'master' of github.com:jedisct1/iptoasn-webservice:
  Bump log from 0.4.6 to 0.4.8
2019-12-04 16:41:37 +01:00
Frank Denis 0ddd4efb0e
Merge pull request #22 from jedisct1/dependabot/cargo/log-0.4.8
Bump log from 0.4.6 to 0.4.8
2019-12-04 09:07:14 +01:00
dependabot-preview[bot] ba42dd3742
Bump log from 0.4.6 to 0.4.8
Bumps [log](https://github.com/rust-lang/log) from 0.4.6 to 0.4.8.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.6...0.4.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-04 04:59:53 +00:00
Frank Denis ff4b312c3e Merge branch 'master' of github.com:jedisct1/iptoasn-webservice
* 'master' of github.com:jedisct1/iptoasn-webservice:
  Bump horrorshow from 0.6.6 to 0.7.0
  Bump serde_json from 1.0.39 to 1.0.42
2019-12-03 17:49:44 +01:00
Frank Denis 584b0ca9e7
Merge pull request #17 from jedisct1/dependabot/cargo/horrorshow-0.7.0
Bump horrorshow from 0.6.6 to 0.7.0
2019-12-03 17:49:26 +01:00
Frank Denis 66fba5987a Update horrowshow 2019-12-03 17:49:10 +01:00
Frank Denis 32a804cd8d
Merge pull request #16 from jedisct1/dependabot/cargo/serde_json-1.0.42
Bump serde_json from 1.0.39 to 1.0.42
2019-12-03 17:23:02 +01:00
dependabot-preview[bot] 9c80aee3de
Bump horrorshow from 0.6.6 to 0.7.0
Bumps [horrorshow](https://github.com/Stebalien/horrorshow-rs) from 0.6.6 to 0.7.0.
- [Release notes](https://github.com/Stebalien/horrorshow-rs/releases)
- [Commits](https://github.com/Stebalien/horrorshow-rs/compare/v0.6.6...v0.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-03 16:00:32 +00:00
dependabot-preview[bot] 9d46adc3e0
Bump serde_json from 1.0.39 to 1.0.42
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.39 to 1.0.42.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.39...v1.0.42)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-03 16:00:09 +00:00
Frank Denis 3bf5aa5ec4
Update README.md 2019-06-19 13:49:35 +02:00
Frank Denis f943be0100 Return Expires: headers 2019-05-26 17:32:30 +02:00
Frank Denis f339052e8c Switch to Rust 2018 2019-04-03 01:58:51 +02:00
Frank Denis e854072dbb Update deps 2019-04-03 01:56:32 +02:00
Frank Denis 1e4974b0d6 Add fakeroot to travis 2019-02-18 15:51:14 +01:00
Frank Denis 775cd628e0 Bump 2019-02-18 14:42:37 +01:00
Frank Denis 60e4052d65 Clippify 2019-02-18 14:41:52 +01:00
Frank Denis 39ee8bc5bd Update the flates crate 2019-02-18 14:39:37 +01:00
Frank Denis 3d75b1ab67 Deps update 2019-02-18 14:36:52 +01:00
Frank Denis 2a4b785963 2018 2018-10-29 17:35:06 +01:00
Frank Denis e46de6c05b Any recent stable Rust will do. But no DNS history for now. 2018-10-29 17:34:21 +01:00
Frank Denis 976d4f84ff nits 2018-07-18 19:14:05 +02:00
Frank Denis c9127a27bf
Merge pull request #13 from ilyaglow/docker-fixes
Fix dockerized iptoasn-webservice
2018-07-18 19:12:39 +02:00
Ilya Glotov d0ac396e12
Fix dockerized iptoasn
* Downgrade alpine from edge to 3.7, where libressl is 2.6 (needed for
openssl crate) and almost everything is more robust.
* Copy to the container only required files.
* Add libgcc package.
* Add readme file.
2018-07-18 18:23:41 +03:00
Frank Denis 4092f6d9fe Merge branch 'master' of github.com:jedisct1/iptoasn-webservice
* 'master' of github.com:jedisct1/iptoasn-webservice:
  Update readme
2018-02-18 21:45:20 +01:00
Frank Denis 25a3d524de Update deps and make clippy happy 2018-02-18 21:44:19 +01:00
Frank Denis 81db1ff07b Format 2018-02-18 21:28:09 +01:00
Frank Denis 1cb77d9323 Merge pull request #8 from ilyaglow/readme-update
Update project readme
2017-09-26 23:53:12 +02:00
Ilya Glotov 37966bd369
Update readme
* Add ip field in JSON output
* Add Travis CI shield
2017-09-27 00:25:40 +03:00
Frank Denis 5f8505d80d _ -> - 2017-09-12 17:56:14 +02:00
Frank Denis 70bab797dc Version bump 2017-09-12 15:32:52 +02:00
Frank Denis 811c41e27e Send a Vary: Accept, Accept-Encoding header 2017-09-12 15:32:12 +02:00
Frank Denis 4f9788847e Update deps 2017-09-12 15:12:03 +02:00
Frank Denis ab403d9998 Format 2017-09-04 19:56:45 +02:00
Frank Denis 51c944585f Update deps 2017-09-04 19:56:39 +02:00
Frank Denis 06b34c0e39 Format 2017-08-12 14:32:05 +02:00
Frank Denis 45ac24c589 Merge branch 'master' of github.com:jedisct1/iptoasn-webservice
* 'master' of github.com:jedisct1/iptoasn-webservice:
  Add entrypoint shell script
  Add docker support
2017-08-12 14:15:19 +02:00
Frank Denis 2f7aebf0e8 Always put the IP in the map, even for HTML responses 2017-08-12 14:14:59 +02:00
Frank Denis 9a9f0e29b7 Update deps 2017-08-12 14:14:44 +02:00
Frank Denis 5dda861524 Merge pull request #5 from ilyaglow/docker-support
Docker support
2017-08-01 00:04:07 +02:00
Ilya Glotov 79f0803fd5
Add entrypoint shell script
Listen port and database URL can be configured by using
environment variables: IPTOASN_PORT AND IPTOASN_DBURL

Docker container for the iptoasn_webservice may be used as a
binary - arbitrary args will be passed to the service if supplied
2017-07-31 20:44:50 +03:00
Ilya Glotov c8d367c97f
Add docker support
Based on alpine image, runs as a regular user
2017-07-28 16:08:17 +03:00
Frank Denis 5d350247b6 Merge branch 'master' of github.com:jedisct1/iptoasn-webservice
* 'master' of github.com:jedisct1/iptoasn-webservice:
  Use hyper_native_tls
  Update deps
  Remove unneeded derefs
2017-07-27 17:47:44 +02:00
Frank Denis 25ecb8d1ad Include the IP address in JSON responses 2017-07-27 17:47:01 +02:00
Frank Denis db603cd65d Update dependencies 2017-07-27 17:43:54 +02:00
Frank Denis 627ab61ccf Use hyper_native_tls 2017-05-12 14:13:41 +02:00
Frank Denis 77d07722a0 Update deps 2017-05-12 13:58:57 +02:00
Frank Denis 7955d0d55a Remove unneeded derefs 2017-05-12 13:58:52 +02:00
Frank Denis 3a36b3ac6e Better Cargo.toml 2017-04-27 22:43:28 +02:00
Frank Denis 2bab4b0afb Uninstalling Rust on Travis requires something different 2017-04-27 22:34:13 +02:00
Frank Denis f9d7237671 Big update of dependencies, and we don't need nightly any more 2017-04-27 22:27:21 +02:00
Frank Denis affc16b0ef Fix dash 2017-02-07 11:48:32 +01:00
Frank Denis 3762554903 Remove unused `#[macro_use]` import 2017-02-06 18:24:19 +01:00
Frank Denis b2d17e6458 Merge pull request #1 from angt/fix-nightly
Fix build on nightly
2017-02-06 18:22:52 +01:00
Adrien Gallouët 6b1b675d47 Fix build on nightly 2017-02-06 17:14:03 +00:00
Frank Denis 59e79d5259 Nits 2016-11-14 12:28:15 +01:00
Frank Denis 390204f479 Nits 2016-11-12 23:44:47 +01:00
Frank Denis b31f97163f Optimize release builds 2016-11-12 21:19:02 +01:00
Frank Denis f7d8e46752 Add the ability to return a super basic HTML page 2016-11-12 21:10:36 +01:00
Frank Denis ef3a57328e Update dependencies 2016-11-12 19:25:06 +01:00
Frank Denis b1183810b8 Teaser 2016-10-27 17:39:46 +02:00
18 changed files with 417 additions and 1248 deletions

8
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10

22
.github/workflows/ci.yml vendored Normal file
View File

@ -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

4
.gitignore vendored
View File

@ -1,3 +1,3 @@
# Generated by Cargo
# will have compiled files and executables
*~
Cargo.lock
/target/

View File

@ -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

810
Cargo.lock generated
View File

@ -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"

View File

@ -1,22 +1,31 @@
[package]
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>"]
edition = "2018"
[dependencies]
clap = "*"
flate2 = "*"
hyper = "*"
iron = "*"
log = "*"
router = "*"
serde = "*"
serde_json = "*"
slog = "*"
slog-envlogger = "*"
slog-stdlog = "*"
slog-term = "*"
clippy = {version = "*", optional = true}
clap = { version = "3.0.0", features = ["std", "cargo", "wrap_help"] }
flate2 = "1"
horrorshow = "0.8"
hyper = "0.10"
hyper-native-tls = "0.3"
iron = "0.6"
log = "0.4"
router = "0.6"
serde_json = "1.0"
unicase = "1"
time = "0.1"
[features]
default = []
[profile.release]
lto = true
panic = "abort"
opt-level = 3

View File

@ -1,6 +1,6 @@
BSD 2-Clause License
Copyright (c) 2016, Frank Denis
Copyright (c) 2016-2021, Frank Denis
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,15 +1,17 @@
![Build Status](https://github.com/jedisct1/iptoasn-webservice/workflows/Rust/badge.svg)
# iptoasn-webservice
Webservice to map IP addresses to AS information.
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:
```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
{
@ -18,6 +20,7 @@ $ curl https://api.iptoasn.com/v1/as/ip/<ip address>
"as_description": "LEVEL3 - Level 3 Communications, Inc.",
"as_number": 3356,
"first_ip": "4.0.0.0",
"ip": "4.3.2.1",
"last_ip": "4.23.87.255"
}
```

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

32
docker/Dockerfile Normal file
View File

@ -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"]

36
docker/README.md Normal file
View File

@ -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
```

View File

@ -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

View File

@ -1,10 +1,12 @@
use flate2::read::GzDecoder;
use hyper::{self, client};
use std::cmp::{Eq, PartialOrd, PartialEq, Ord, Ordering};
use std::collections::Bound::{Included, Unbounded};
use hyper::net::HttpsConnector;
use hyper::{self, Client};
use hyper_native_tls::NativeTlsClient;
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
use std::collections::BTreeSet;
use std::io::prelude::*;
use std::net::IpAddr;
use std::ops::Bound::{Included, Unbounded};
use std::str::FromStr;
#[derive(Debug)]
@ -55,7 +57,9 @@ pub struct ASNs {
impl ASNs {
pub fn new(url: &str) -> Result<ASNs, &'static str> {
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();
if res.status != hyper::Ok {
error!("Unable to load the database");
@ -63,7 +67,7 @@ impl ASNs {
}
assert_eq!(res.status, hyper::Ok);
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();
for line in data.split_terminator('\n') {
let mut parts = line.split('\t');
@ -73,21 +77,21 @@ impl ASNs {
let country = parts.next().unwrap().to_owned();
let description = parts.next().unwrap().to_owned();
let asn = ASN {
first_ip: first_ip,
last_ip: last_ip,
number: number,
country: country,
description: description,
first_ip,
last_ip,
number,
country,
description,
};
asns.insert(asn);
}
info!("Database loaded");
Ok(ASNs { asns: asns })
Ok(ASNs { asns })
}
pub fn lookup_by_ip(&self, ip: IpAddr) -> Option<&ASN> {
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),
_ => None,
}

View File

@ -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]
extern crate router;
extern crate hyper;
extern crate horrorshow;
#[macro_use]
extern crate log;
extern crate serde;
extern crate serde_json;
#[macro_use(slog_error, slog_info, slog_trace, slog_log, o)]
extern crate slog;
#[macro_use]
extern crate router;
#[macro_use]
extern crate clap;
mod asns;
mod webservice;
use asns::*;
use clap::{Arg, App};
use crate::asns::*;
use crate::webservice::*;
use clap::Arg;
use std::sync::{Arc, RwLock};
use std::thread;
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> {
info!("Retrieving ASNs");
@ -60,36 +36,34 @@ fn update_asns(asns_arc: &Arc<RwLock<Arc<ASNs>>>, db_url: &str) {
}
fn main() {
logger_init();
let matches = App::new("iptoasn webservice")
.version("0.2.0")
.author("Frank Denis")
.about("Webservice for https://iptoasn.com")
.arg(Arg::with_name("listen_addr")
.short("l")
.long("listen")
.value_name("ip:port")
.help("Webservice IP and port")
.takes_value(true)
.default_value("0.0.0.0:53661"))
.arg(Arg::with_name("db_url")
.short("u")
.long("dburl")
.value_name("url")
.help("URL of the gzipped database")
.takes_value(true)
.default_value("https://iptoasn.com/data/ip2asn-combined.tsv.gz"))
let matches = app_from_crate!()
.arg(
Arg::new("listen_addr")
.short('l')
.long("listen")
.value_name("ip:port")
.help("Webservice IP and port")
.takes_value(true)
.default_value("0.0.0.0:53661"),
)
.arg(
Arg::new("db_url")
.short('u')
.long("dburl")
.value_name("url")
.help("URL of the gzipped database")
.takes_value(true)
.default_value("https://iptoasn.com/data/ip2asn-combined.tsv.gz"),
)
.get_matches();
let db_url = matches.value_of("db_url").unwrap().to_owned();
let listen_addr = matches.value_of("listen_addr").unwrap();
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_copy = asns_arc.clone();
thread::spawn(move || {
loop {
thread::sleep(Duration::from_secs(3600));
update_asns(&asns_arc_copy, &db_url);
}
thread::spawn(move || loop {
thread::sleep(Duration::from_secs(3600));
update_asns(&asns_arc_copy, &db_url);
});
info!("Starting the webservice");
WebService::start(asns_arc, listen_addr);

View File

@ -1,17 +1,20 @@
use asns::*;
use iron::{BeforeMiddleware, typemap};
use iron::headers::{CacheControl, CacheDirective};
use crate::asns::*;
use horrorshow::prelude::*;
use iron::headers::{Accept, CacheControl, CacheDirective, Expires, HttpDate, Vary};
use iron::mime::*;
use iron::modifiers::Header;
use iron::prelude::*;
use iron::status;
use iron::{typemap, BeforeMiddleware};
use router::Router;
use serde_json;
use std::net::IpAddr;
use std::str::FromStr;
use std::sync::{Arc, RwLock};
use time::{self, Duration};
use unicase::UniCase;
const TTL: u32 = 86400;
const TTL: u32 = 86_400;
struct ASNsMiddleware {
asns_arc: Arc<RwLock<Arc<ASNs>>>,
@ -23,82 +26,252 @@ impl typemap::Key for ASNsMiddleware {
impl ASNsMiddleware {
fn new(asns_arc: Arc<RwLock<Arc<ASNs>>>) -> ASNsMiddleware {
ASNsMiddleware { asns_arc: asns_arc }
ASNsMiddleware { asns_arc }
}
}
impl BeforeMiddleware for ASNsMiddleware {
fn before(&self, req: &mut Request) -> IronResult<()> {
req.extensions.insert::<ASNsMiddleware>(self.asns_arc.read().unwrap().clone());
fn before(&self, req: &mut Request<'_, '_>) -> IronResult<()> {
req.extensions
.insert::<ASNsMiddleware>(self.asns_arc.read().unwrap().clone());
Ok(())
}
}
enum OutputType {
Json,
Html,
}
pub struct WebService;
impl WebService {
fn index(_: &mut Request) -> IronResult<Response> {
Ok(Response::with((status::Ok,
Mime(TopLevel::Text,
SubLevel::Plain,
vec![(Attr::Charset, Value::Utf8)]),
Header(CacheControl(vec![CacheDirective::Public,
CacheDirective::MaxAge(TTL)])),
"See https://iptoasn.com")))
fn index(_: &mut Request<'_, '_>) -> IronResult<Response> {
Ok(Response::with((
status::Ok,
Mime(
TopLevel::Text,
SubLevel::Plain,
vec![(Attr::Charset, Value::Utf8)],
),
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> {
let mime_text = Mime(TopLevel::Text,
SubLevel::Plain,
vec![(Attr::Charset, Value::Utf8)]);
let mime_json = Mime(TopLevel::Application,
SubLevel::Json,
vec![(Attr::Charset, Value::Utf8)]);
let cache_header = Header(CacheControl(vec![CacheDirective::Public,
CacheDirective::MaxAge(TTL)]));
fn accept_type(req: &Request<'_, '_>) -> OutputType {
let mut output_type = OutputType::Json;
if let Some(header_accept) = req.headers.get::<Accept>() {
for header in header_accept.iter() {
match header.item {
Mime(TopLevel::Text, SubLevel::Html, _) => {
output_type = OutputType::Html;
break;
}
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") {
None => {
let response = Response::with((status::BadRequest,
mime_text,
cache_header,
"Missing IP address"));
let response = Response::with((
status::BadRequest,
mime_text,
cache_headers,
"Missing IP address",
));
return Ok(response);
}
Some(ip_str) => ip_str,
};
let ip = match IpAddr::from_str(ip_str) {
Err(_) => {
return Ok(Response::with((status::BadRequest,
mime_text,
cache_header,
"Invalid IP address")));
return Ok(Response::with((
status::BadRequest,
mime_text,
cache_headers,
"Invalid IP address",
)));
}
Ok(ip) => ip,
};
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) {
None => {
let mut map = serde_json::Map::new();
map.insert("announced", serde_json::value::Value::Bool(false));
let json = serde_json::to_string(&map).unwrap();
return Ok(Response::with((status::Ok, mime_json, cache_header, json)));
map.insert(
"announced".to_string(),
serde_json::value::Value::Bool(false),
);
return Self::output(&Self::accept_type(req), &map, cache_headers, vary_header);
}
Some(found) => found,
};
let mut map = serde_json::Map::new();
map.insert("announced", serde_json::value::Value::Bool(true));
map.insert("first_ip",
serde_json::value::Value::String(found.first_ip.to_string()));
map.insert("last_ip",
serde_json::value::Value::String(found.last_ip.to_string()));
map.insert("as_number",
serde_json::value::Value::U64(found.number as u64));
map.insert("as_country_code",
serde_json::value::Value::String(found.country.clone()));
map.insert("as_description",
serde_json::value::Value::String(found.description.clone()));
let json = serde_json::to_string(&map).unwrap();
Ok(Response::with((status::Ok, mime_json, cache_header, json)))
map.insert(
"announced".to_string(),
serde_json::value::Value::Bool(true),
);
map.insert(
"first_ip".to_string(),
serde_json::value::Value::String(found.first_ip.to_string()),
);
map.insert(
"last_ip".to_string(),
serde_json::value::Value::String(found.last_ip.to_string()),
);
map.insert(
"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) {