Created
November 11, 2022 14:02
-
-
Save fusetim/78c866bdd599fa842838228f9f669c3e to your computer and use it in GitHub Desktop.
NAT-PMP external client for QBittorrent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is automatically @generated by Cargo. | |
# It is not intended for manual editing. | |
[[package]] | |
name = "anyhow" | |
version = "1.0.58" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" | |
[[package]] | |
name = "async-trait" | |
version = "0.1.56" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" | |
dependencies = [ | |
"proc-macro2", | |
"quote", | |
"syn", | |
] | |
[[package]] | |
name = "autocfg" | |
version = "1.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" | |
[[package]] | |
name = "base64" | |
version = "0.13.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" | |
[[package]] | |
name = "bumpalo" | |
version = "3.11.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" | |
[[package]] | |
name = "bytes" | |
version = "1.2.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" | |
[[package]] | |
name = "cc" | |
version = "1.0.73" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" | |
[[package]] | |
name = "cfg-if" | |
version = "1.0.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | |
[[package]] | |
name = "encoding_rs" | |
version = "0.8.31" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" | |
dependencies = [ | |
"cfg-if", | |
] | |
[[package]] | |
name = "fnv" | |
version = "1.0.7" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" | |
[[package]] | |
name = "form_urlencoded" | |
version = "1.0.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" | |
dependencies = [ | |
"matches", | |
"percent-encoding", | |
] | |
[[package]] | |
name = "futures-channel" | |
version = "0.3.23" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "2bfc52cbddcfd745bf1740338492bb0bd83d76c67b445f91c5fb29fae29ecaa1" | |
dependencies = [ | |
"futures-core", | |
] | |
[[package]] | |
name = "futures-core" | |
version = "0.3.23" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "d2acedae88d38235936c3922476b10fced7b2b68136f5e3c03c2d5be348a1115" | |
[[package]] | |
name = "futures-io" | |
version = "0.3.23" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "93a66fc6d035a26a3ae255a6d2bca35eda63ae4c5512bef54449113f7a1228e5" | |
[[package]] | |
name = "futures-sink" | |
version = "0.3.23" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "ca0bae1fe9752cf7fd9b0064c674ae63f97b37bc714d745cbde0afb7ec4e6765" | |
[[package]] | |
name = "futures-task" | |
version = "0.3.23" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "842fc63b931f4056a24d59de13fb1272134ce261816e063e634ad0c15cdc5306" | |
[[package]] | |
name = "futures-util" | |
version = "0.3.23" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "f0828a5471e340229c11c77ca80017937ce3c58cb788a17e5f1c2d5c485a9577" | |
dependencies = [ | |
"futures-core", | |
"futures-io", | |
"futures-task", | |
"memchr", | |
"pin-project-lite", | |
"pin-utils", | |
"slab", | |
] | |
[[package]] | |
name = "h2" | |
version = "0.3.14" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" | |
dependencies = [ | |
"bytes", | |
"fnv", | |
"futures-core", | |
"futures-sink", | |
"futures-util", | |
"http", | |
"indexmap", | |
"slab", | |
"tokio", | |
"tokio-util", | |
"tracing", | |
] | |
[[package]] | |
name = "hashbrown" | |
version = "0.12.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" | |
[[package]] | |
name = "hermit-abi" | |
version = "0.1.19" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" | |
dependencies = [ | |
"libc", | |
] | |
[[package]] | |
name = "http" | |
version = "0.2.8" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" | |
dependencies = [ | |
"bytes", | |
"fnv", | |
"itoa", | |
] | |
[[package]] | |
name = "http-body" | |
version = "0.4.5" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" | |
dependencies = [ | |
"bytes", | |
"http", | |
"pin-project-lite", | |
] | |
[[package]] | |
name = "httparse" | |
version = "1.7.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" | |
[[package]] | |
name = "httpdate" | |
version = "1.0.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" | |
[[package]] | |
name = "hyper" | |
version = "0.14.20" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" | |
dependencies = [ | |
"bytes", | |
"futures-channel", | |
"futures-core", | |
"futures-util", | |
"h2", | |
"http", | |
"http-body", | |
"httparse", | |
"httpdate", | |
"itoa", | |
"pin-project-lite", | |
"socket2", | |
"tokio", | |
"tower-service", | |
"tracing", | |
"want", | |
] | |
[[package]] | |
name = "idna" | |
version = "0.2.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" | |
dependencies = [ | |
"matches", | |
"unicode-bidi", | |
"unicode-normalization", | |
] | |
[[package]] | |
name = "indexmap" | |
version = "1.9.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" | |
dependencies = [ | |
"autocfg", | |
"hashbrown", | |
] | |
[[package]] | |
name = "ipnet" | |
version = "2.5.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" | |
[[package]] | |
name = "itoa" | |
version = "1.0.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" | |
[[package]] | |
name = "js-sys" | |
version = "0.3.59" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" | |
dependencies = [ | |
"wasm-bindgen", | |
] | |
[[package]] | |
name = "lazy_static" | |
version = "1.4.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" | |
[[package]] | |
name = "libc" | |
version = "0.2.126" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" | |
[[package]] | |
name = "log" | |
version = "0.4.17" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" | |
dependencies = [ | |
"cfg-if", | |
] | |
[[package]] | |
name = "matches" | |
version = "0.1.9" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" | |
[[package]] | |
name = "memchr" | |
version = "2.5.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" | |
[[package]] | |
name = "mime" | |
version = "0.3.16" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" | |
[[package]] | |
name = "mio" | |
version = "0.8.4" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" | |
dependencies = [ | |
"libc", | |
"log", | |
"wasi", | |
"windows-sys", | |
] | |
[[package]] | |
name = "natpmp" | |
version = "0.3.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "19eaefbb33f9a03984c5e85e764b8db45444146bc277c9346054f453a62976ad" | |
dependencies = [ | |
"async-trait", | |
"cc", | |
"tokio", | |
] | |
[[package]] | |
name = "natpmp-setup" | |
version = "0.1.0" | |
dependencies = [ | |
"anyhow", | |
"natpmp", | |
"reqwest", | |
] | |
[[package]] | |
name = "num_cpus" | |
version = "1.13.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" | |
dependencies = [ | |
"hermit-abi", | |
"libc", | |
] | |
[[package]] | |
name = "once_cell" | |
version = "1.13.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "074864da206b4973b84eb91683020dbefd6a8c3f0f38e054d93954e891935e4e" | |
[[package]] | |
name = "percent-encoding" | |
version = "2.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" | |
[[package]] | |
name = "pin-project-lite" | |
version = "0.2.9" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" | |
[[package]] | |
name = "pin-utils" | |
version = "0.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" | |
[[package]] | |
name = "proc-macro2" | |
version = "1.0.40" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" | |
dependencies = [ | |
"unicode-ident", | |
] | |
[[package]] | |
name = "quote" | |
version = "1.0.20" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" | |
dependencies = [ | |
"proc-macro2", | |
] | |
[[package]] | |
name = "reqwest" | |
version = "0.11.11" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" | |
dependencies = [ | |
"base64", | |
"bytes", | |
"encoding_rs", | |
"futures-core", | |
"futures-util", | |
"h2", | |
"http", | |
"http-body", | |
"hyper", | |
"ipnet", | |
"js-sys", | |
"lazy_static", | |
"log", | |
"mime", | |
"percent-encoding", | |
"pin-project-lite", | |
"serde", | |
"serde_json", | |
"serde_urlencoded", | |
"tokio", | |
"tower-service", | |
"url", | |
"wasm-bindgen", | |
"wasm-bindgen-futures", | |
"web-sys", | |
"winreg", | |
] | |
[[package]] | |
name = "ryu" | |
version = "1.0.11" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" | |
[[package]] | |
name = "serde" | |
version = "1.0.144" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" | |
[[package]] | |
name = "serde_json" | |
version = "1.0.83" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" | |
dependencies = [ | |
"itoa", | |
"ryu", | |
"serde", | |
] | |
[[package]] | |
name = "serde_urlencoded" | |
version = "0.7.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" | |
dependencies = [ | |
"form_urlencoded", | |
"itoa", | |
"ryu", | |
"serde", | |
] | |
[[package]] | |
name = "slab" | |
version = "0.4.7" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" | |
dependencies = [ | |
"autocfg", | |
] | |
[[package]] | |
name = "socket2" | |
version = "0.4.4" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" | |
dependencies = [ | |
"libc", | |
"winapi", | |
] | |
[[package]] | |
name = "syn" | |
version = "1.0.98" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" | |
dependencies = [ | |
"proc-macro2", | |
"quote", | |
"unicode-ident", | |
] | |
[[package]] | |
name = "tinyvec" | |
version = "1.6.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" | |
dependencies = [ | |
"tinyvec_macros", | |
] | |
[[package]] | |
name = "tinyvec_macros" | |
version = "0.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" | |
[[package]] | |
name = "tokio" | |
version = "1.19.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439" | |
dependencies = [ | |
"bytes", | |
"libc", | |
"memchr", | |
"mio", | |
"num_cpus", | |
"once_cell", | |
"pin-project-lite", | |
"socket2", | |
"winapi", | |
] | |
[[package]] | |
name = "tokio-util" | |
version = "0.7.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" | |
dependencies = [ | |
"bytes", | |
"futures-core", | |
"futures-sink", | |
"pin-project-lite", | |
"tokio", | |
"tracing", | |
] | |
[[package]] | |
name = "tower-service" | |
version = "0.3.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" | |
[[package]] | |
name = "tracing" | |
version = "0.1.36" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" | |
dependencies = [ | |
"cfg-if", | |
"pin-project-lite", | |
"tracing-core", | |
] | |
[[package]] | |
name = "tracing-core" | |
version = "0.1.29" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" | |
dependencies = [ | |
"once_cell", | |
] | |
[[package]] | |
name = "try-lock" | |
version = "0.2.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" | |
[[package]] | |
name = "unicode-bidi" | |
version = "0.3.8" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" | |
[[package]] | |
name = "unicode-ident" | |
version = "1.0.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" | |
[[package]] | |
name = "unicode-normalization" | |
version = "0.1.21" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" | |
dependencies = [ | |
"tinyvec", | |
] | |
[[package]] | |
name = "url" | |
version = "2.2.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" | |
dependencies = [ | |
"form_urlencoded", | |
"idna", | |
"matches", | |
"percent-encoding", | |
] | |
[[package]] | |
name = "want" | |
version = "0.3.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" | |
dependencies = [ | |
"log", | |
"try-lock", | |
] | |
[[package]] | |
name = "wasi" | |
version = "0.11.0+wasi-snapshot-preview1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" | |
[[package]] | |
name = "wasm-bindgen" | |
version = "0.2.82" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" | |
dependencies = [ | |
"cfg-if", | |
"wasm-bindgen-macro", | |
] | |
[[package]] | |
name = "wasm-bindgen-backend" | |
version = "0.2.82" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" | |
dependencies = [ | |
"bumpalo", | |
"log", | |
"once_cell", | |
"proc-macro2", | |
"quote", | |
"syn", | |
"wasm-bindgen-shared", | |
] | |
[[package]] | |
name = "wasm-bindgen-futures" | |
version = "0.4.32" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" | |
dependencies = [ | |
"cfg-if", | |
"js-sys", | |
"wasm-bindgen", | |
"web-sys", | |
] | |
[[package]] | |
name = "wasm-bindgen-macro" | |
version = "0.2.82" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" | |
dependencies = [ | |
"quote", | |
"wasm-bindgen-macro-support", | |
] | |
[[package]] | |
name = "wasm-bindgen-macro-support" | |
version = "0.2.82" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" | |
dependencies = [ | |
"proc-macro2", | |
"quote", | |
"syn", | |
"wasm-bindgen-backend", | |
"wasm-bindgen-shared", | |
] | |
[[package]] | |
name = "wasm-bindgen-shared" | |
version = "0.2.82" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" | |
[[package]] | |
name = "web-sys" | |
version = "0.3.59" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" | |
dependencies = [ | |
"js-sys", | |
"wasm-bindgen", | |
] | |
[[package]] | |
name = "winapi" | |
version = "0.3.9" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" | |
dependencies = [ | |
"winapi-i686-pc-windows-gnu", | |
"winapi-x86_64-pc-windows-gnu", | |
] | |
[[package]] | |
name = "winapi-i686-pc-windows-gnu" | |
version = "0.4.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | |
[[package]] | |
name = "winapi-x86_64-pc-windows-gnu" | |
version = "0.4.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | |
[[package]] | |
name = "windows-sys" | |
version = "0.36.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" | |
dependencies = [ | |
"windows_aarch64_msvc", | |
"windows_i686_gnu", | |
"windows_i686_msvc", | |
"windows_x86_64_gnu", | |
"windows_x86_64_msvc", | |
] | |
[[package]] | |
name = "windows_aarch64_msvc" | |
version = "0.36.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" | |
[[package]] | |
name = "windows_i686_gnu" | |
version = "0.36.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" | |
[[package]] | |
name = "windows_i686_msvc" | |
version = "0.36.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" | |
[[package]] | |
name = "windows_x86_64_gnu" | |
version = "0.36.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" | |
[[package]] | |
name = "windows_x86_64_msvc" | |
version = "0.36.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" | |
[[package]] | |
name = "winreg" | |
version = "0.10.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" | |
dependencies = [ | |
"winapi", | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "natpmp-setup" | |
version = "0.1.0" | |
authors = ["FuseTim <[email protected]>"] | |
edition = "2021" | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | |
[dependencies] | |
natpmp = "0.3.2" | |
anyhow = "*" | |
reqwest = { version = "0.11", default_features = false, features = ["blocking"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use anyhow::{anyhow, bail, Result}; | |
use natpmp::*; | |
use reqwest::blocking::Client; | |
use reqwest::Url; | |
use std::thread; | |
use std::time::Duration; | |
fn main() -> Result<()> { | |
let gateway = std::env::var("NATPMP_GATEWAY_IP").unwrap_or("10.2.0.1".to_owned()); | |
let mut n = | |
Natpmp::new_with((&gateway).parse().unwrap()).expect("Parsing gateway address failed!"); | |
let mut client = Client::default(); | |
let mut timeout = 250; | |
let _ = query_gateway(&mut n).expect("Quering Public IP failed!"); | |
let mut mr = query_available_port(&mut n).expect("Quering a Port Mapping failed!"); | |
update_qbittorrent(&mut client, mr.public_port()).expect("Failed to update QBittorrent."); | |
loop { | |
thread::sleep(mr.lifetime().clone() / 2); //Renew at half lifetime | |
let mr_ = query_port(&mut n, mr.private_port(), mr.public_port(), true) | |
.or(query_available_port(&mut n)) | |
.expect("Every renewal method failed!"); | |
if mr.public_port() != mr_.public_port() { | |
println!("Port has changed, setting incoming port on QBittorrent..."); | |
update_qbittorrent(&mut client, mr.public_port()) | |
.expect("Failed to update QBittorrent."); | |
} | |
mr = mr_; | |
} | |
Ok(()) | |
} | |
fn update_qbittorrent(client: &mut Client, port: u16) -> Result<()> { | |
client | |
.get(Url::parse("http://127.0.0.1:8080/api/v2/app/setPreferences").unwrap()) | |
.query(&[("json", &format!(r#"{{"listen_port":{}}}"#, port))]) | |
.send()? | |
.error_for_status()?; | |
Ok(()) | |
} | |
fn query_gateway(n: &mut Natpmp) -> Result<GatewayResponse> { | |
let mut timeout = 250; | |
while timeout <= 64000 { | |
n.send_public_address_request() | |
.map_err(|err| anyhow!("Fail with {:?}", err))?; | |
println!( | |
"Public address request sent! (will timeout in {}ms)", | |
timeout | |
); | |
thread::sleep(Duration::from_millis(timeout)); | |
match n.read_response_or_retry() { | |
Err(e) => match e { | |
Error::NATPMP_TRYAGAIN => println!("Try again later"), | |
_ => return Err(anyhow!("Try again: {:?}", e)), | |
}, | |
Ok(Response::Gateway(gr)) => { | |
println!( | |
"Got response: IP: {}, Epoch: {}", | |
gr.public_address(), | |
gr.epoch() | |
); | |
return Ok(gr); | |
} | |
_ => { | |
bail!("Expecting a gateway response"); | |
} | |
}; | |
timeout *= 2; | |
} | |
bail!("Quering gateway failed!"); | |
} | |
fn query_available_port(n: &mut Natpmp) -> Result<MappingResponse> { | |
return query_port(n, 0, 0, false); | |
} | |
fn query_port( | |
n: &mut Natpmp, | |
internal: u16, | |
external: u16, | |
check: bool, | |
) -> Result<MappingResponse> { | |
let mut timeout = 250; | |
while timeout <= 64000 { | |
n.send_port_mapping_request(Protocol::TCP, 0, 0, 360) | |
.map_err(|err| anyhow!("Fail with {:?}", err)); | |
println!("Port mapping request sent! (will timeout in {}ms)", timeout); | |
// sleep for a while | |
thread::sleep(Duration::from_millis(1000)); | |
match n.read_response_or_retry() { | |
Err(e) => match e { | |
Error::NATPMP_TRYAGAIN => println!("Try again later"), | |
_ => return Err(anyhow!("Try again later: {:?}", e)), | |
}, | |
Ok(Response::TCP(tr)) => { | |
println!( | |
"Got response: Internal: {}, External: {}, Lifetime: {}s", | |
tr.private_port(), | |
tr.public_port(), | |
tr.lifetime().as_secs() | |
); | |
if (!check) | |
|| (tr.private_port() == internal | |
&& tr.public_port() == external | |
&& tr.lifetime().as_secs() > 0) | |
{ | |
return Ok(tr); | |
} else { | |
println!("Retring, port is not the one wanted!"); | |
} | |
} | |
_ => { | |
bail!("Expecting a tcp response"); | |
} | |
}; | |
timeout *= 2; | |
} | |
bail!("Mapping failed!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment