aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2020-07-28 16:39:35 +0200
committerGravatar Miek Gieben <miek@miek.nl> 2020-07-28 16:39:35 +0200
commitf21fa187383b7d1ba1c18ee617cb70e810cf1485 (patch)
treee7d9271855e48cc6973b8e3b5c3e8fd4f325c246
parent37e6038788beb5ee1154e71bb3fc07c3e708fa5d (diff)
downloadcoredns-torrent.tar.gz
coredns-torrent.tar.zst
coredns-torrent.zip
Move to new torrent libtorrent
Signed-off-by: Miek Gieben <miek@miek.nl>
-rw-r--r--core/dnsserver/zdirectives.go2
-rw-r--r--core/plugin/zplugin.go2
-rw-r--r--go.mod1
-rw-r--r--go.sum21
-rw-r--r--plugin.cfg2
-rw-r--r--plugin/torrent/README.md48
-rw-r--r--plugin/torrent/info.go75
-rw-r--r--plugin/torrent/session.go49
-rw-r--r--plugin/torrent/setup.go58
-rw-r--r--plugin/torrent/setup_test.go53
-rw-r--r--plugin/torrent/testdata/db.miek.nl17
-rw-r--r--plugin/torrent/torrent.go9
12 files changed, 25 insertions, 312 deletions
diff --git a/core/dnsserver/zdirectives.go b/core/dnsserver/zdirectives.go
index b01118a01..6c700304b 100644
--- a/core/dnsserver/zdirectives.go
+++ b/core/dnsserver/zdirectives.go
@@ -55,5 +55,5 @@ var Directives = []string{
"whoami",
"on",
"sign",
- "torrent",
+ "bittorrent",
}
diff --git a/core/plugin/zplugin.go b/core/plugin/zplugin.go
index 7c43917e0..62985edca 100644
--- a/core/plugin/zplugin.go
+++ b/core/plugin/zplugin.go
@@ -11,6 +11,7 @@ import (
_ "github.com/coredns/coredns/plugin/autopath"
_ "github.com/coredns/coredns/plugin/azure"
_ "github.com/coredns/coredns/plugin/bind"
+ _ "github.com/coredns/coredns/plugin/bittorrent"
_ "github.com/coredns/coredns/plugin/bufsize"
_ "github.com/coredns/coredns/plugin/cache"
_ "github.com/coredns/coredns/plugin/cancel"
@@ -46,7 +47,6 @@ import (
_ "github.com/coredns/coredns/plugin/sign"
_ "github.com/coredns/coredns/plugin/template"
_ "github.com/coredns/coredns/plugin/tls"
- _ "github.com/coredns/coredns/plugin/torrent"
_ "github.com/coredns/coredns/plugin/trace"
_ "github.com/coredns/coredns/plugin/transfer"
_ "github.com/coredns/coredns/plugin/whoami"
diff --git a/go.mod b/go.mod
index 4cfb3545f..0be183736 100644
--- a/go.mod
+++ b/go.mod
@@ -8,6 +8,7 @@ require (
github.com/Azure/go-autorest/autorest/azure/auth v0.5.0
github.com/DataDog/datadog-go v3.5.0+incompatible // indirect
github.com/Shopify/sarama v1.21.0 // indirect
+ github.com/anacrolix/torrent v1.0.0
github.com/apache/thrift v0.13.0 // indirect
github.com/aws/aws-sdk-go v1.33.7
github.com/caddyserver/caddy v1.0.5
diff --git a/go.sum b/go.sum
index cb568ede6..c392cb98a 100644
--- a/go.sum
+++ b/go.sum
@@ -74,6 +74,7 @@ github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb0
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks=
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
+github.com/RoaringBitmap/roaring v0.4.7 h1:eGUudvFzvF7Kxh7JjYvXfI1f7l22/2duFby7r5+d4oc=
github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w=
github.com/SermoDigital/jose v0.0.0-20180104203859-803625baeddc/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
@@ -92,24 +93,33 @@ github.com/alicebob/miniredis v2.4.6+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+Dx
github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190808125512-07798873deee/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ=
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/anacrolix/dht v0.0.0-20180412060941-24cbf25b72a4/go.mod h1:hQfX2BrtuQsLQMYQwsypFAab/GvHg8qxwVi4OJdR1WI=
+github.com/anacrolix/dht v0.0.0-20181129074040-b09db78595aa h1:5RyX9Tvqa9oewlJhFihkxe8biS0ojTlrNU3ryqm5g2s=
github.com/anacrolix/dht v0.0.0-20181129074040-b09db78595aa/go.mod h1:Ayu4t+5TsHQ07/P8XzRJqVofv7lU4R1ZTT7KW5+SPFA=
+github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa h1:xCaATLKmn39QqLs3tUZYr6eKvezJV+FYvVOLTklxK6U=
github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
github.com/anacrolix/go-libutp v0.0.0-20180522111405-6baeb806518d/go.mod h1:beQSaSxwH2d9Eeu5ijrEnHei5Qhk+J6cDm1QkWFru4E=
+github.com/anacrolix/go-libutp v0.0.0-20180808010927-aebbeb60ea05 h1:Zoniih3jyqtr3I0xFoMvw1USWpg+CbI/zOrcLudr0lc=
github.com/anacrolix/go-libutp v0.0.0-20180808010927-aebbeb60ea05/go.mod h1:POY/GPlrFKRxnOKH1sGAB+NBWMoP+sI+hHJxgcgWbWw=
github.com/anacrolix/log v0.0.0-20180412014343-2323884b361d/go.mod h1:sf/7c2aTldL6sRQj/4UKyjgVZBu2+M2z9wf7MmwPiew=
+github.com/anacrolix/log v0.0.0-20180808012509-286fcf906b48 h1:aHwCj9Q6sjQOq5sC8Bzylt7GCAvt+D5MPEpkD6TeXxU=
github.com/anacrolix/log v0.0.0-20180808012509-286fcf906b48/go.mod h1:sf/7c2aTldL6sRQj/4UKyjgVZBu2+M2z9wf7MmwPiew=
github.com/anacrolix/missinggo v0.0.0-20180522035225-b4a5853e62ff/go.mod h1:b0p+7cn+rWMIphK1gDH2hrDuwGOcbB6V4VXeSsEfHVk=
github.com/anacrolix/missinggo v0.0.0-20180725070939-60ef2fbf63df/go.mod h1:kwGiTUTZ0+p4vAz3VbAI5a30t2YbvemcmspjKwrAz5s=
+github.com/anacrolix/missinggo v0.0.0-20181129073415-3237bf955fed h1:pMzstxgUXooGmNxZnjFSsnjtFd7s81sNI7L2pzEuWWs=
github.com/anacrolix/missinggo v0.0.0-20181129073415-3237bf955fed/go.mod h1:IN+9GUe7OxKMIs/XeXEbT/rMUolmJzmlZiXHS7FwD/Y=
+github.com/anacrolix/mmsg v0.0.0-20180515031531-a4a3ba1fc8bb h1:2Or5ccMoY4Kfao+WdL2w6tpY6ZEe+2VTVbIPd7A/Ajk=
github.com/anacrolix/mmsg v0.0.0-20180515031531-a4a3ba1fc8bb/go.mod h1:x2/ErsYUmT77kezS63+wzZp8E3byYB0gzirM/WMBLfw=
github.com/anacrolix/sync v0.0.0-20171108081538-eee974e4f8c1/go.mod h1:+u91KiUuf0lyILI6x3n/XrW7iFROCZCG+TjgK8nW52w=
github.com/anacrolix/sync v0.0.0-20180611022320-3c4cb11f5a01/go.mod h1:+u91KiUuf0lyILI6x3n/XrW7iFROCZCG+TjgK8nW52w=
+github.com/anacrolix/sync v0.0.0-20180808010631-44578de4e778 h1:XpCDEixzXOB8yaTW/4YBzKrJdMcFI0DzpPTYNv75wzk=
github.com/anacrolix/sync v0.0.0-20180808010631-44578de4e778/go.mod h1:s735Etp3joe/voe2sdaXLcqDdJSay1O0OPnM0ystjqk=
github.com/anacrolix/tagflag v0.0.0-20180109131632-2146c8d41bf0/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
github.com/anacrolix/tagflag v0.0.0-20180605133421-f477c8c2f14c/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
github.com/anacrolix/tagflag v0.0.0-20180803105420-3a8ff5428f76/go.mod h1:1m2U/K6ZT+JZG0+bdMK6qauP49QT4wE5pmhJXOKKCHw=
github.com/anacrolix/torrent v0.0.0-20180622074351-fefeef4ee9eb/go.mod h1:3vcFVxgOASslNXHdivT8spyMRBanMCenHRpe0u5vpBs=
+github.com/anacrolix/torrent v1.0.0 h1:MxNBr5lKDK/fRtvAYPOzGGQrpj+70Lh7E5EVjzIIbXg=
github.com/anacrolix/torrent v1.0.0/go.mod h1:N6lCILah/qQCk/gVjHsOnqaug7a5DqQyryCbZD1L188=
+github.com/anacrolix/utp v0.0.0-20180219060659-9e0e1d1d0572 h1:kpt6TQTVi6gognY+svubHfxxpq0DLU9AfTQyZVc3UOc=
github.com/anacrolix/utp v0.0.0-20180219060659-9e0e1d1d0572/go.mod h1:MDwc+vsGEq7RMw6lr2GKOEqjWny5hO5OZXRVNaBJ2Dk=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI=
@@ -123,9 +133,11 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
+github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/br0xen/termbox-util v0.0.0-20170904143325-de1d4c83380e/go.mod h1:x9wJlgOj74OFTOBwXOuO8pBguW37EgYNx51Dbjkfzo4=
github.com/br0xen/termbox-util v0.0.0-20200220160819-dc6d6950ba00/go.mod h1:x9wJlgOj74OFTOBwXOuO8pBguW37EgYNx51Dbjkfzo4=
+github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2 h1:1B/+1BcRhOMG1KH/YhNIU8OppSWk5d/NGyfRla88CuY=
github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
github.com/caddyserver/caddy v1.0.5 h1:5B1Hs0UF2x2tggr2X9jL2qOZtDXbIWQb9YLbmlxHSuM=
github.com/caddyserver/caddy v1.0.5/go.mod h1:AnFHB+/MrgRC+mJAvuAgQ38ePzw+wKeW0wzENpdQQKY=
@@ -187,8 +199,10 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
+github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
+github.com/elgatito/upnp v0.0.0-20180711183757-2f244d205f9a h1:2Zw3pxDRTs4nX1WCLAEm27UN0hvjZSge7EaUUQexRZw=
github.com/elgatito/upnp v0.0.0-20180711183757-2f244d205f9a/go.mod h1:afkYpY8JAIL4341N7Zj9xJ5yTovsg6BkWfBFlCzIoF4=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -210,6 +224,7 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
+github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd h1:r04MMPyLHj/QwZuMJ5+7tJcBr1AQjpiAK/rZWRrQT7o=
github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE=
github.com/go-acme/lego/v3 v3.1.0/go.mod h1:074uqt+JS6plx+c9Xaiz6+L+GBb+7itGtzfcDM2AhEE=
github.com/go-acme/lego/v3 v3.2.0/go.mod h1:074uqt+JS6plx+c9Xaiz6+L+GBb+7itGtzfcDM2AhEE=
@@ -336,6 +351,7 @@ github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uG
github.com/hokaccha/go-prettyjson v0.0.0-20190818114111-108c894c2c0e/go.mod h1:pFlLw2CfqZiIBOx6BuCeRLCrfxBJipTY0nIOF/VbGcI=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
+github.com/huandu/xstrings v1.0.0 h1:pO2K/gKgKaat5LdpAhxhluX2GPQMaI3W5FUz/I/UnWk=
github.com/huandu/xstrings v1.0.0/go.mod h1:4qWG/gcEcfX4z/mBDHJ++3ReCw9ibxbsNJbcucJdbSo=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4=
@@ -408,6 +424,7 @@ github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzp
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.7.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
+github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
@@ -466,6 +483,7 @@ github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGV
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
+github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 h1:lM6RxxfUMrYL/f8bWEUqdXrANWtrL7Nndbm9iFN0DlU=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
@@ -528,6 +546,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 h1:GHRpF1pTW19a8tTFrMLUcfWwyC0pnifVo2ClaLq+hP8=
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46/go.mod h1:uAQ5PCi+MFsC7HjREoAz1BU+Mq60+05gifQSsHSDG/8=
github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
@@ -575,7 +594,9 @@ github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA=
github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
+github.com/willf/bitset v1.1.9 h1:GBtFynGY9ZWZmEC9sWuu41/7VBXPFCOAbCbqTflOg9c=
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
+github.com/willf/bloom v0.0.0-20170505221640-54e3b963ee16 h1:hDGatoumfYOxzIZGsSylJuxTzu9k86BJl8OQhm72anI=
github.com/willf/bloom v0.0.0-20170505221640-54e3b963ee16/go.mod h1:MmAltL9pDMNTrvUkxdg0k0q5I0suxmuwp3KbyrZLOZ8=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
diff --git a/plugin.cfg b/plugin.cfg
index 27137fec4..ae8ef01fd 100644
--- a/plugin.cfg
+++ b/plugin.cfg
@@ -64,4 +64,4 @@ erratic:erratic
whoami:whoami
on:github.com/caddyserver/caddy/onevent
sign:sign
-torrent:torrent
+bittorrent:bittorrent
diff --git a/plugin/torrent/README.md b/plugin/torrent/README.md
deleted file mode 100644
index 1cc273c41..000000000
--- a/plugin/torrent/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# torrent
-
-## Name
-
-*torrent* - use BitTorrent to disseminate zone data.
-
-## Description
-
-The *torrent* plugin uses the BitTorrent protocol to disseminate zone data. Multiple peers can
-connect and down- and upload the data. A couple of nodes can be `seed` only meaning they will update
-the torrent when their zone data changes. Non-`seed` peers will write received data back into the
-zonefile - once the torrent is fully downloaded.
-
-## Syntax
-
-The simplest syntax is for a peer wanting to receive the zone data:
-
-~~~ txt
-torrent DBFILE
-~~~
-
-* **DBFILE** the zone database file to torrent. If the path is relative, the path from the
- *root* plugin will be prepended to it.
-
-For peers seeding the torrent use this, slightly expanded, syntax
-
-~~~ txt
-torrent DBFILE {
- dht
-// directory (temp storage)
-// port for dth, etc.
-}
-~~~
-
-* `dth` starts a DTH server on address
-
-## Examples
-
-~~~ txt
-example.org {
- file db.example.org
- torrent db.example.org
-}
-~~~
-
-## Also See
-
-## Bugs
diff --git a/plugin/torrent/info.go b/plugin/torrent/info.go
deleted file mode 100644
index 8aa8f720a..000000000
--- a/plugin/torrent/info.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package torrent
-
-import (
- "crypto/sha1"
- "io"
- "os"
- "strings"
-
- "github.com/zeebo/bencode"
-)
-
-const pieceLength = 2048 * 10
-
-// pieces will hash the file in path on 256kb boundaries and return the (sha1) hashes.
-func pieces(path string) (int, string, error) {
- f, err := os.Open(path)
- if err != nil {
- return 0, "", err
- }
- hashes := "" // concatenated string of hash (strings)
- buf := make([]byte, 2048)
- h := sha1.New()
- chunk := 0
- length := 0
- n, err := f.Read(buf)
- for err != nil {
- h.Write(buf[:n])
- chunk++
- length += n
- if chunk > 10 {
- chunk = 0
- hashes += string(h.Sum(nil))
- h = sha1.New()
- }
- n, err = f.Read(buf)
- }
- if n > 0 {
- length += n
- h.Write(buf[:n])
- hashes += string(h.Sum(nil))
- }
-
- return length, hashes, nil
-}
-
-// Info is the torrent meta data for a single file.
-type Info struct {
- Pieces string `bencode:"pieces"`
- PieceLength int `bencode:"piece length"`
- Length int `bencode:"length"`
- Name string `bencode:"name"`
-}
-
-// TorrentInfo contains the meta data for this torrent.
-type TorrentInfo struct {
- Nodes []string `bencode:"nodes"`
- Info Info `bencode:"info"`
-}
-
-func NewTorrentInfo(path string) (*TorrentInfo, error) {
- length, pieces, err := pieces(path)
- if err != nil {
- return nil, err
- }
- i := Info{Pieces: pieces, PieceLength: 2048 * 10, Length: length, Name: path}
- return &TorrentInfo{Nodes: []string{}, Info: i}, nil
-}
-
-func (t *TorrentInfo) ToReader() io.Reader {
- s, err := bencode.EncodeString(t)
- if err != nil {
- return nil
- }
- return strings.NewReader(s)
-}
diff --git a/plugin/torrent/session.go b/plugin/torrent/session.go
deleted file mode 100644
index 22c5d99d8..000000000
--- a/plugin/torrent/session.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package torrent
-
-import (
- "io/ioutil"
- "log"
- "path/filepath"
- "time"
-
- rtorrent "github.com/cenkalti/rain/torrent"
-)
-
-func (t *Torrent) Do() error {
- dc := rtorrent.DefaultConfig
- dc.DHTEnabled = t.dht
- dc.RPCEnabled = false
- dc.DHTBootstrapNodes = []string{"127.0.0.1:7246"} // its a me
-
- td, err := ioutil.TempDir("", "example")
- if err != nil {
- return err
- }
- dc.DataDir = td
- dc.Database = filepath.Join(td, "session.db")
- s, err := rtorrent.NewSession(dc)
- if err != nil {
- return err
- }
-
- ti, err := NewTorrentInfo("plugin/torrent/testdata/db.miek.nl")
- if err != nil {
- return err
- }
-
- tor, err := s.AddTorrent(ti.ToReader(), nil)
- if err != nil {
- return err
- }
- // mag, _ := tor.Magnet()
-
- go s.StartAll()
-
- // Watch the progress
- for range time.Tick(time.Second) {
- s := tor.Stats()
- log.Printf("Status: %s, Downloaded: %d, Peers: %d", s.Status.String(), s.Bytes.Completed, s.Peers.Total)
- }
- return nil
-
-}
diff --git a/plugin/torrent/setup.go b/plugin/torrent/setup.go
deleted file mode 100644
index 5458e5a1c..000000000
--- a/plugin/torrent/setup.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package torrent
-
-import (
- "path/filepath"
-
- "github.com/coredns/coredns/core/dnsserver"
- "github.com/coredns/coredns/plugin"
-
- "github.com/caddyserver/caddy"
-)
-
-func init() { plugin.Register("torrent", setup) }
-
-func setup(c *caddy.Controller) error {
- tor, err := parse(c)
- if err != nil {
- return plugin.Error("torrent", err)
- }
-
- c.OnStartup(func() error {
- err := tor.Do()
- return err
- })
- c.OnShutdown(func() error {
- close(tor.stop)
- return nil
- })
-
- // Don't call AddPlugin, *sign* is not a plugin.
- return nil
-}
-
-func parse(c *caddy.Controller) (*Torrent, error) {
- t := &Torrent{stop: make(chan struct{})}
- config := dnsserver.GetConfig(c)
-
- for c.Next() {
- if !c.NextArg() {
- return nil, c.ArgErr()
- }
- dbfile := c.Val()
- if !filepath.IsAbs(dbfile) && config.Root != "" {
- dbfile = filepath.Join(config.Root, dbfile)
- }
- t.dbfile = dbfile
-
- for c.NextBlock() {
- switch c.Val() {
- case "dht":
- t.dht = true
- default:
- return nil, c.Errf("unknown property '%s'", c.Val())
- }
- }
- }
-
- return t, nil
-}
diff --git a/plugin/torrent/setup_test.go b/plugin/torrent/setup_test.go
deleted file mode 100644
index ae2f7baf5..000000000
--- a/plugin/torrent/setup_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package torrent
-
-import (
- "testing"
-
- "github.com/caddyserver/caddy"
-)
-
-func TestParse(t *testing.T) {
- tests := []struct {
- input string
- shouldErr bool
- exp *Torrent
- }{
- {`torrent testdata/db.miek.nl {
- dht
- }`,
- false,
- &Torrent{dbfile: "testdata/db.miek.nl", dht: true},
- },
- {`torrent testdata/db.miek.nl`,
- false,
- &Torrent{dbfile: "testdata/db.miek.nl"},
- },
- // errors
- {`torrent db.example.org {
- bla
- }`,
- true,
- nil,
- },
- }
- for i, tc := range tests {
- c := caddy.NewTestController("dns", tc.input)
- tor, err := parse(c)
-
- if err == nil && tc.shouldErr {
- t.Fatalf("Test %d expected errors, but got no error", i)
- }
- if err != nil && !tc.shouldErr {
- t.Fatalf("Test %d expected no errors, but got '%v'", i, err)
- }
- if tc.shouldErr {
- continue
- }
- if x := tor.dbfile; x != tc.exp.dbfile {
- t.Errorf("Test %d expected %s as dbfile, got %s", i, tc.exp.dbfile, x)
- }
- if x := tor.dth; x != tc.exp.dth {
- t.Errorf("Test %d expected %T as seed, got %T", i, tc.exp.dth, x)
- }
- }
-}
diff --git a/plugin/torrent/testdata/db.miek.nl b/plugin/torrent/testdata/db.miek.nl
deleted file mode 100644
index 4041b1b5e..000000000
--- a/plugin/torrent/testdata/db.miek.nl
+++ /dev/null
@@ -1,17 +0,0 @@
-$TTL 30M
-$ORIGIN miek.nl.
-@ IN SOA linode.atoom.net. miek.miek.nl. ( 1282630060 4H 1H 7D 4H )
- IN NS linode.atoom.net.
- IN MX 1 aspmx.l.google.com.
- IN AAAA 2a01:7e00::f03c:91ff:fe79:234c
- IN DNSKEY 257 3 13 sfzRg5nDVxbeUc51su4MzjgwpOpUwnuu81SlRHqJuXe3SOYOeypR69tZ52XLmE56TAmPHsiB8Rgk+NTpf0o1Cw==
-
-a IN AAAA 2a01:7e00::f03c:91ff:fe79:234c
-www IN CNAME a
-
-
-bla IN NS ns1.bla.com.
-ns3.blaaat.miek.nl. IN AAAA ::1 ; non-glue, should be signed.
-; in baliwick nameserver that requires glue, should not be signed
-bla IN NS ns2.bla.miek.nl.
-ns2.bla.miek.nl. IN A 127.0.0.1
diff --git a/plugin/torrent/torrent.go b/plugin/torrent/torrent.go
deleted file mode 100644
index 4c008b834..000000000
--- a/plugin/torrent/torrent.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package torrent
-
-// Torrent contains the file data that needs to be torrented.
-type Torrent struct {
- dbfile string
- dht bool
-
- stop chan struct{}
-}