Compare commits

...

52 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
17 changed files with 180 additions and 1250 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,64 +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
- os: linux
rust: stable
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

847
Cargo.lock generated
View File

@ -1,847 +0,0 @@
[root]
name = "iptoasn-webservice"
version = "0.2.2"
dependencies = [
"clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy 0.0.159 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)",
"horrorshow 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "advapi32-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 = "ansi_term"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "antidote"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "atty"
version = "0.2.2"
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.30 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "base64"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"safemem 0.2.0 (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 = "bitflags"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "byteorder"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cargo_metadata"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clap"
version = "2.26.0"
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)",
"atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clippy"
version = "0.0.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"clippy_lints 0.0.159 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clippy_lints"
version = "0.0.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itertools 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.0.15 (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.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-normalization 0.1.5 (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.24 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "core-foundation-sys"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crypt32-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 = "custom_derive"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "dtoa"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "either"
version = "1.1.0"
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.1.0 (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.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "foreign-types"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gcc"
version = "0.3.53"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "getopts"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "horrorshow"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "httparse"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hyper"
version = "0.10.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.2.3 (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.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
"traitobject 0.1.0 (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.2 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hyper-native-tls"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "idna"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "iron"
version = "0.5.1"
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.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.6.2 (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.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itertools"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "itoa"
version = "0.3.3"
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.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "log"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "magenta"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "magenta-sys"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "matches"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "mime"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "miniz-sys"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (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 = "native-tls"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"openssl 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)",
"schannel 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "num_cpus"
version = "1.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl"
version = "0.9.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-sys"
version = "0.9.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "percent-encoding"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pkg-config"
version = "0.3.9"
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 = "pulldown-cmark"
version = "0.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.15 (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 = "quote"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rand"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "regex-syntax"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "route-recognizer"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "router"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rustc-serialize"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "safemem"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "schannel"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crypt32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"secur32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"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 = "secur32-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 = "security-framework"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
"security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "security-framework-sys"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "serde_derive"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive_internals 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_derive_internals"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "serde_json"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "strsim"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "syn"
version = "0.11.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "synom"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"unicode-xid 0.0.4 (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.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "term_size"
version = "0.3.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.30 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "textwrap"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "time"
version = "0.1.38"
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.30 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.31 (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.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "traitobject"
version = "0.1.0"
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.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicase"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-bidi"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unicode-normalization"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-segmentation"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-width"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unicode-xid"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "unsafe-any"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "url"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "vcpkg"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "vec_map"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "version_check"
version = "0.1.3"
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 advapi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e06588080cb19d0acb6739808aafa5f26bfb2ca015b2b6370028b44cf7cb8a9a"
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
"checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5"
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
"checksum base64 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96434f987501f0ed4eb336a411e0631ecd1afa11574fe148587adc4ff96143c9"
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff81738b726f5d099632ceaffe7fb65b90212e8dce59d518729e7e8634032d3d"
"checksum cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be1057b8462184f634c3a208ee35b0f935cfd94b694b26deadccd98732088d7b"
"checksum clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2267a8fdd4dce6956ba6649e130f62fb279026e5e84b92aa939ac8f85ce3f9f0"
"checksum clippy 0.0.159 (registry+https://github.com/rust-lang/crates.io-index)" = "0d9b99905cbc0d72b54182a379652ab3db1d2c7617e8935679155f2a11e695e9"
"checksum clippy_lints 0.0.159 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4d4721437f4229a1a7e8b5b7c83415e2b693582d0c3d6eaab051a03367b3d3"
"checksum conduit-mime-types 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "95ca30253581af809925ef68c2641cc140d6183f43e12e0af4992d53768bd7b8"
"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
"checksum core-foundation 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "25bfd746d203017f7d5cbd31ee5d8e17f94b6521c7af77ece6c9e4b2d4b16c67"
"checksum core-foundation-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "065a5d7ffdcbc8fa145d6f0746f3555025b9097a9e9cda59f7467abae670c78d"
"checksum crypt32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e34988f7e069e0b2f3bfc064295161e489b2d4e04a2e4248fb94360cdf00b4ec"
"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
"checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a"
"checksum error 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e606f14042bb87cc02ef6a14db6c90ab92ed6f62d87e69377bc759fd7987cc"
"checksum flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)" = "36df0166e856739905cd3d7e0b210fe818592211a008862599845e012d8d304c"
"checksum foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e4056b9bd47f8ac5ba12be771f77a0dae796d1bbaaf5fd0b9c2d38b69b8a29d"
"checksum gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)" = "e8310f7e9c890398b0e80e301c4f474e9918d2b27fca8f48486ca775fa9ffc5a"
"checksum getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "65922871abd2f101a2eb0eaebadc66668e54a87ad9c3dd82520b5f86ede5eff9"
"checksum horrorshow 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d587765115bf4e613f0c88e3fcad077dc9b1a339de89912f6a75f21049938bce"
"checksum httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "af2f2dd97457e8fb1ae7c5a420db346af389926e36f43768b96f101546b04a07"
"checksum hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)" = "368cb56b2740ebf4230520e2b90ebb0461e69034d85d1945febd9b3971426db2"
"checksum hyper-native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "72332e4a35d3059583623b50e98e491b78f8b96c5521fcb3f428167955aa56e8"
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
"checksum iron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2440ae846e7a8c7f9b401db8f6e31b4ea5e7d3688b91761337da7e054520c75b"
"checksum itertools 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "22c285d60139cf413244894189ca52debcfd70b57966feed060da76802e415a0"
"checksum itoa 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ac17257442c2ed77dbc9fd555cf83c58b0c7f7d0e8f2ae08c0ac05c72842e1f6"
"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.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf"
"checksum libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)" = "2370ca07ec338939e356443dac2296f581453c35fe1e3a3ed06023c49435f915"
"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527"
"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
"checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
"checksum miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "28eaee17666671fa872e567547e8428e83308ebe5808cdf6a0e28397dbe2c726"
"checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58"
"checksum native-tls 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04b781c9134a954c84f0594b9ab3f5606abc516030388e8511887ef4c204a1e5"
"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0"
"checksum num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584"
"checksum openssl 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)" = "085aaedcc89a2fac1eb2bc19cd66f29d4ea99fec60f82a5f3a88a6be7dbd90b5"
"checksum openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7e3a9845a4c9fdb321931868aae5549e96bb7b979bf9af7de03603d74691b5f3"
"checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0"
"checksum pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "378e941dbd392c101f2cb88097fa4d7167bc421d4b88de3ff7dbee503bc3233b"
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
"checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf"
"checksum redox_syscall 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "8dde11f18c108289bef24469638a04dce49da56084f2d50618b226e47eb04509"
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
"checksum route-recognizer 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3255338088df8146ba63d60a9b8e3556f1146ce2973bc05a75181a42ce2256"
"checksum router 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9b1797ff166029cb632237bb5542696e54961b4cf75a324c6f05c9cf0584e4e"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
"checksum schannel 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "14a5f8491ae5fc8c51aded1f5806282a0218b4d69b1b76913a0559507e559b90"
"checksum secur32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f412dfa83308d893101dd59c10d6fda8283465976c28c287c5c855bf8d216bc"
"checksum security-framework 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "dfa44ee9c54ce5eecc9de7d5acbad112ee58755239381f687e564004ba4a2332"
"checksum security-framework-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "5421621e836278a0b139268f36eee0dc7e389b784dc3f79d8f11aabadf41bead"
"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "bcb6a7637a47663ee073391a139ed07851f27ed2532c2abc88c6bf27a16cdf34"
"checksum serde_derive 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "812ff66056fd9a9a5b7c119714243b0862cf98340e7d4b5ee05a932c40d5ea6c"
"checksum serde_derive_internals 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd381f6d01a6616cdba8530492d453b7761b456ba974e98768a18cad2cd76f58"
"checksum serde_json 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d243424e06f9f9c39e3cd36147470fd340db785825e367625f79298a6ac6b7ac"
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
"checksum term_size 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2b6b55df3198cc93372e85dd2ed817f0e38ce8cc0f22eb32391bfad9c4bf209"
"checksum textwrap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f728584ea33b0ad19318e20557cb0a39097751dbb07171419673502f848c7af6"
"checksum time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d788d3aa77bc0ef3e9621256885555368b47bd495c13dd2e7413c89f845520"
"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e"
"checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
"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.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
"checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946"
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
"checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f"
"checksum url 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb819346883532a271eb626deb43c4a1bb4c4dd47c519bd78137c3e72a4fe27"
"checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
"checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
"checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
"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,25 +1,26 @@
[package]
name = "iptoasn-webservice"
description = "API server for iptoasn.com"
version = "0.2.2"
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 = "~2"
flate2 = "~0.2"
horrorshow = "~0.6"
hyper = "~0.10"
hyper-native-tls = "~0.2"
iron = "~0.5"
log = "~0.3"
router = "~0.5"
serde_json = "~1.0"
clippy = {version = "~0", optional = true}
unicase = "~1.4"
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 = []

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 (and DNS history, soon).
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 >= 1.17](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,57 +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() {
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
}

View File

@ -1,13 +1,14 @@
FROM alpine:edge
FROM alpine:3.17.7
COPY ./ /tmp
COPY Cargo.* /tmp/iptoasn/
COPY src /tmp/iptoasn/src
WORKDIR /tmp
WORKDIR /tmp/iptoasn
RUN apk update \
&& apk add --no-cache ca-certificates \
libressl \
llvm-libunwind \
RUN apk add --update --no-cache ca-certificates \
libressl \
llvm-libunwind \
libgcc \
&& apk add --no-cache --virtual .build-rust \
rust \
cargo \
@ -16,15 +17,16 @@ RUN apk update \
&& cargo build --release \
&& strip target/release/iptoasn-webservice \
&& mv target/release/iptoasn-webservice /usr/bin/iptoasn-webservice \
&& mv docker/iptoasn-entrypoint.sh /iptoasn-entrypoint.sh \
&& chmod +x /iptoasn-entrypoint.sh \
&& adduser -D app \
\
&& apk del .build-rust \
&& rm -rf ~/.cargo \
/var/cache/apk/* \
/tmp/* \
&& apk del .build-rust
/tmp/*
COPY docker/iptoasn-entrypoint.sh /iptoasn-entrypoint.sh
RUN chmod +x /iptoasn-entrypoint.sh
RUN adduser -D app
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

@ -1,12 +1,12 @@
use flate2::read::GzDecoder;
use hyper::{self, Client};
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::collections::Bound::{Included, Unbounded};
use std::io::prelude::*;
use std::net::IpAddr;
use std::ops::Bound::{Included, Unbounded};
use std::str::FromStr;
#[derive(Debug)]
@ -67,10 +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');
@ -80,16 +77,16 @@ 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> {

View File

@ -1,29 +1,21 @@
#![cfg_attr(feature = "clippy", feature(plugin))]
#![cfg_attr(feature = "clippy", plugin(clippy))]
extern crate clap;
extern crate flate2;
#[macro_use]
extern crate horrorshow;
extern crate hyper;
extern crate hyper_native_tls;
extern crate iron;
#[macro_use]
extern crate log;
#[macro_use]
extern crate router;
extern crate serde_json;
extern crate unicase;
#[macro_use]
extern crate clap;
mod asns;
mod webservice;
use asns::*;
use clap::{App, Arg};
use crate::asns::*;
use crate::webservice::*;
use clap::Arg;
use std::sync::{Arc, RwLock};
use std::thread;
use std::time::Duration;
use webservice::*;
fn get_asns(db_url: &str) -> Result<ASNs, &'static str> {
info!("Retrieving ASNs");
@ -44,13 +36,10 @@ fn update_asns(asns_arc: &Arc<RwLock<Arc<ASNs>>>, db_url: &str) {
}
fn main() {
let matches = App::new("iptoasn webservice")
.version("0.2.0")
.author("Frank Denis")
.about("Webservice for https://iptoasn.com")
let matches = app_from_crate!()
.arg(
Arg::with_name("listen_addr")
.short("l")
Arg::new("listen_addr")
.short('l')
.long("listen")
.value_name("ip:port")
.help("Webservice IP and port")
@ -58,8 +47,8 @@ fn main() {
.default_value("0.0.0.0:53661"),
)
.arg(
Arg::with_name("db_url")
.short("u")
Arg::new("db_url")
.short('u')
.long("dburl")
.value_name("url")
.help("URL of the gzipped database")

View File

@ -1,19 +1,20 @@
use asns::*;
use crate::asns::*;
use horrorshow::prelude::*;
use iron::{typemap, BeforeMiddleware};
use iron::headers::{Accept, CacheControl, CacheDirective, Vary};
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>>>,
@ -25,12 +26,12 @@ 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<()> {
fn before(&self, req: &mut Request<'_, '_>) -> IronResult<()> {
req.extensions
.insert::<ASNsMiddleware>(self.asns_arc.read().unwrap().clone());
Ok(())
@ -45,7 +46,7 @@ enum OutputType {
pub struct WebService;
impl WebService {
fn index(_: &mut Request) -> IronResult<Response> {
fn index(_: &mut Request<'_, '_>) -> IronResult<Response> {
Ok(Response::with((
status::Ok,
Mime(
@ -53,14 +54,18 @@ impl WebService {
SubLevel::Plain,
vec![(Attr::Charset, Value::Utf8)],
),
Header(CacheControl(
vec![CacheDirective::Public, CacheDirective::MaxAge(TTL)],
)),
Header(CacheControl(vec![
CacheDirective::Public,
CacheDirective::MaxAge(TTL),
])),
Header(Expires(HttpDate(
time::now() + Duration::seconds(TTL.into()),
))),
"See https://iptoasn.com",
)))
}
fn accept_type(req: &Request) -> OutputType {
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() {
@ -81,8 +86,8 @@ impl WebService {
}
fn output_json(
map: serde_json::Map<String, serde_json::value::Value>,
cache_header: Header<CacheControl>,
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();
@ -91,14 +96,19 @@ impl WebService {
SubLevel::Json,
vec![(Attr::Charset, Value::Utf8)],
);
Ok(Response::with(
(status::Ok, mime_json, cache_header, vary_header, json),
))
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_header: Header<CacheControl>,
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(
@ -125,7 +135,7 @@ impl WebService {
td { : format_args!("{}", if map.get("announced")
.unwrap().as_bool().unwrap() { "Yes" } else { "No" }) }
}
@ if map.get("announced").unwrap().as_bool().unwrap() == true {
@ if map.get("announced").unwrap().as_bool().unwrap() {
tr {
th { : "First IP" }
td { : format_args!("{}", map.get("first_ip")
@ -154,36 +164,46 @@ impl WebService {
}
}
}
}
.into_string()
}.into_string()
.unwrap();
let html = format!("<!DOCTYPE html>\n<html>{}</html>", html);
Ok(Response::with(
(status::Ok, mime_html, cache_header, vary_header, 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_header: Header<CacheControl>,
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_header, vary_header),
_ => Self::output_html(map, cache_header, vary_header),
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> {
fn ip_lookup(req: &mut Request<'_, '_>) -> IronResult<Response> {
let mime_text = Mime(
TopLevel::Text,
SubLevel::Plain,
vec![(Attr::Charset, Value::Utf8)],
);
let cache_header = Header(CacheControl(
vec![CacheDirective::Public, CacheDirective::MaxAge(TTL)],
));
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(),
@ -193,7 +213,7 @@ impl WebService {
let response = Response::with((
status::BadRequest,
mime_text,
cache_header,
cache_headers,
"Missing IP address",
));
return Ok(response);
@ -205,7 +225,7 @@ impl WebService {
return Ok(Response::with((
status::BadRequest,
mime_text,
cache_header,
cache_headers,
"Invalid IP address",
)));
}
@ -223,7 +243,7 @@ impl WebService {
"announced".to_string(),
serde_json::value::Value::Bool(false),
);
return Self::output(Self::accept_type(&req), map, cache_header, vary_header);
return Self::output(&Self::accept_type(req), &map, cache_headers, vary_header);
}
Some(found) => found,
};
@ -251,7 +271,7 @@ impl WebService {
"as_description".to_string(),
serde_json::value::Value::String(found.description.clone()),
);
Self::output(Self::accept_type(&req), map, cache_header, vary_header)
Self::output(&Self::accept_type(req), &map, cache_headers, vary_header)
}
pub fn start(asns_arc: Arc<RwLock<Arc<ASNs>>>, listen_addr: &str) {