diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 87b18c159c52f91a9e7fdafd6889b7051e8e76d5..fa646d0b34ced7723ce6a8ba39492365a5215141 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -1,6 +1,6 @@ { "ImportPath": "git.autistici.org/ale/autoradio", - "GoVersion": "go1.4", + "GoVersion": "go1.5.1", "Packages": [ "./..." ], @@ -44,7 +44,7 @@ }, { "ImportPath": "github.com/miekg/dns", - "Rev": "9de5f8465098a64dc05730a954dfa7a2f76f4353" + "Rev": "874ec871288a738d8d87fd5cec1dd71e88fdacb2" }, { "ImportPath": "github.com/nu7hatch/gouuid", @@ -52,7 +52,7 @@ }, { "ImportPath": "github.com/ugorji/go/codec", - "Rev": "03e33114d4d60a1f37150325e15f51b0fa6fc4f6" + "Rev": "5abd4e96a45c386928ed2ca2a7ef63e2533e18ec" } ] } diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/ghostest/main.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/ghostest/main.go index 7f1d817e8501fdc7b04f7c20084f6274e1ac2e87..b3617727c0cf12916c5cb78309905f22ee6f85b1 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/ghostest/main.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/ghostest/main.go @@ -17,10 +17,10 @@ import ( "net/http" "time" - "github.com/PuerkitoBio/ghost/handlers" - "github.com/PuerkitoBio/ghost/templates" - _ "github.com/PuerkitoBio/ghost/templates/amber" - _ "github.com/PuerkitoBio/ghost/templates/gotpl" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates" + _ "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/amber" + _ "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/gotpl" "github.com/bmizerany/pat" ) diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/favicon.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/favicon.go index 0f460fa96d95aba21ed1206d049d5cdc06644d43..3bdaa53cc0f26879e52065c7a1f3e2a3526e5907 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/favicon.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/favicon.go @@ -7,7 +7,7 @@ import ( "strconv" "time" - "github.com/PuerkitoBio/ghost" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost" ) // FaviconHandlerFunc is the same as FaviconHandler, it is just a convenience diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/log.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/log.go index 5a43a71710861d43d13c826c02e58af14518ff61..5e386a689124bee03736cab078e81ec737919e34 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/log.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/log.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/PuerkitoBio/ghost" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost" ) const ( diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/redisstore.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/redisstore.go index 2974e2205a090da64a9cc7c8343f1b8c127c13cb..807a45036ae5d9edde6c584bc979ce9d605c9b7b 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/redisstore.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/redisstore.go @@ -5,7 +5,7 @@ import ( "errors" "time" - "github.com/garyburd/redigo/redis" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/garyburd/redigo/redis" ) var ( diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/session.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/session.go index fb96faa749874735223242b52a97640456adfc9a..e92b44f7dcbef5a502ff3aca53a11465bab1bbb9 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/session.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers/session.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "github.com/PuerkitoBio/ghost" - "github.com/gorilla/securecookie" - "github.com/nu7hatch/gouuid" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gorilla/securecookie" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/nu7hatch/gouuid" ) const defaultCookieName = "ghost.sid" diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/amber/amber.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/amber/amber.go index 81e67e14f76ae59d50dacb49fc0b53e8e6cf61d0..838a73dc24bbbf95fe2eb16c917a2cb52d88bc91 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/amber/amber.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/amber/amber.go @@ -1,7 +1,7 @@ package amber import ( - "github.com/PuerkitoBio/ghost/templates" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates" "github.com/eknkc/amber" ) diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/gotpl/gotpl.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/gotpl/gotpl.go index c012f52a37763413d3c74b339581fa79434a0ca0..e9e76680ddeb55733c854169c49d29c208e4104e 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/gotpl/gotpl.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/gotpl/gotpl.go @@ -3,7 +3,7 @@ package gotpl import ( "html/template" - "github.com/PuerkitoBio/ghost/templates" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates" ) // The template compiler for native Go templates. diff --git a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/template.go b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/template.go index 1e1250af9469a50d784d5bd265b93aa204155c27..b4ec892e43f01fde5734d07e876e0899fa820eff 100644 --- a/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/template.go +++ b/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/templates/template.go @@ -9,7 +9,7 @@ import ( "path/filepath" "sync" - "github.com/PuerkitoBio/ghost" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost" ) var ( diff --git a/Godeps/_workspace/src/github.com/aryann/difflib/difflib_server/difflib_demo.go b/Godeps/_workspace/src/github.com/aryann/difflib/difflib_server/difflib_demo.go index 4888feb4f01a97ef5e0fa49acf7761ab4b723bd8..6d4c3dba4db1a31f7aebe187b29f37bbfeba3667 100644 --- a/Godeps/_workspace/src/github.com/aryann/difflib/difflib_server/difflib_demo.go +++ b/Godeps/_workspace/src/github.com/aryann/difflib/difflib_server/difflib_demo.go @@ -18,7 +18,7 @@ package main import ( "fmt" - "github.com/aryann/difflib" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/aryann/difflib" "html" "html/template" "io/ioutil" diff --git a/Godeps/_workspace/src/github.com/cactus/go-statsd-client/statsd/test-client/main.go b/Godeps/_workspace/src/github.com/cactus/go-statsd-client/statsd/test-client/main.go index 7a7786e19ca6affa9db5220b6fec6f52b622aace..3b90f8502e791d3c51a6eea508916302201e2cd9 100644 --- a/Godeps/_workspace/src/github.com/cactus/go-statsd-client/statsd/test-client/main.go +++ b/Godeps/_workspace/src/github.com/cactus/go-statsd-client/statsd/test-client/main.go @@ -2,7 +2,7 @@ package main import ( "fmt" - "github.com/cactus/go-statsd-client/statsd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/cactus/go-statsd-client/statsd" flags "github.com/jessevdk/go-flags" "log" "os" diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.generated.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.generated.go index eb05e4c893f8165cfee7ae9b4f6673d1a6c6271d..ea9cc30a54969d917b54598618abc5a69e0a5a46 100644 --- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.generated.go +++ b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.generated.go @@ -8,7 +8,7 @@ package etcd import ( "errors" "fmt" - codec1978 "github.com/ugorji/go/codec" + codec1978 "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/ugorji/go/codec" "net/http" "reflect" "runtime" diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.go index dff20c356187f6e048e60759e842947d9c59d479..aaae482612f2e6b1eddc3cf95965cb2af2bc492a 100644 --- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.go +++ b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response.go @@ -7,7 +7,7 @@ import ( "strconv" "time" - "github.com/ugorji/go/codec" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/ugorji/go/codec" ) const ( diff --git a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response_test.go b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response_test.go index 23e0c56eb335a336d1981d14ab1ffd0ea246a3a7..ffd72f5f0aebe0908eefcdcaae2908eb79b127ac 100644 --- a/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response_test.go +++ b/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd/response_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/ugorji/go/codec" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/ugorji/go/codec" ) func createTestNode(size int) *Node { diff --git a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/conn_test.go b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/conn_test.go index 06cd7706afee8efa952e857ff14d2f3ddd20a3b2..bf3e29e6a403edf780e6c6f45e97353934dd51df 100644 --- a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/conn_test.go +++ b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/conn_test.go @@ -24,7 +24,7 @@ import ( "testing" "time" - "github.com/garyburd/redigo/redis" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/garyburd/redigo/redis" ) var writeTests = []struct { diff --git a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pubsub_test.go b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pubsub_test.go index f5a095ed49f7ad605166c2e8f0242a90727b559c..d5af909d5c304231c3ced5cee17423571640134a 100644 --- a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pubsub_test.go +++ b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/pubsub_test.go @@ -16,7 +16,7 @@ package redis_test import ( "fmt" - "github.com/garyburd/redigo/redis" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/garyburd/redigo/redis" "net" "reflect" "sync" diff --git a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/reply_test.go b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/reply_test.go index 057a154a39be91455bd6e4144afdca3c0f083561..c1aad2b275df9d1c0e20daea8a1cc7fa1a89db5b 100644 --- a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/reply_test.go +++ b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/reply_test.go @@ -19,7 +19,7 @@ import ( "reflect" "testing" - "github.com/garyburd/redigo/redis" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/garyburd/redigo/redis" ) type valueError struct { diff --git a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/scan_test.go b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/scan_test.go index b57dd89695e16909cf4609456b7bba36e038c86c..7bf6443da143bf2365417213924fccd3a9ae8579 100644 --- a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/scan_test.go +++ b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/scan_test.go @@ -16,7 +16,7 @@ package redis_test import ( "fmt" - "github.com/garyburd/redigo/redis" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/garyburd/redigo/redis" "math" "reflect" "testing" diff --git a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/script_test.go b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/script_test.go index 6627f4b613508673e4e28412f4991d04ef6fb880..952ee7b6af115721f121bb61584975421d080561 100644 --- a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/script_test.go +++ b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/script_test.go @@ -16,7 +16,7 @@ package redis_test import ( "fmt" - "github.com/garyburd/redigo/redis" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/garyburd/redigo/redis" "reflect" "testing" "time" diff --git a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/zpop_example_test.go b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/zpop_example_test.go index 1d86ee6ce8c53664d5ed66274630c58205f61611..8e8816efff7cfe81f12c141e51fc327567cd8e27 100644 --- a/Godeps/_workspace/src/github.com/garyburd/redigo/redis/zpop_example_test.go +++ b/Godeps/_workspace/src/github.com/garyburd/redigo/redis/zpop_example_test.go @@ -16,7 +16,7 @@ package redis_test import ( "fmt" - "github.com/garyburd/redigo/redis" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/garyburd/redigo/redis" ) // zpop pops a value from the ZSET key using WATCH/MULTI/EXEC commands. diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/commands.go b/Godeps/_workspace/src/github.com/gonuts/commander/commands.go index dabad4039c4188c0f50f71fe9f1588462473b926..645f630c220489f9870fbb8e063b8acb0e5367ac 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/commands.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/commands.go @@ -19,7 +19,7 @@ import ( "strings" "text/template" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) // UsageSection differentiates between sections in the usage text. diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd1.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd1.go index 3dff0f30947e9774f5af093cc5d00eea4b1f797b..b4ad385dfe07770ceefea73916cc1e6f8359bd97 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd1.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd1.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) var cmd_cmd1 = &commander.Command{ diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd2.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd2.go index d63c2d263dadb0adf20559223406db196eab5180..95934cefdc6c1c06023601c533f417f4075201eb 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd2.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_cmd2.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) func ex_make_cmd_cmd2() *commander.Command { diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1.go index 87f741385f36b7f41ec604f5be99ec7a3b030efa..a16af269abd3b316282a68d2726bde343aa756f3 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1.go @@ -1,8 +1,8 @@ package main import ( - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) var cmd_subcmd1 = &commander.Command{ diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd1.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd1.go index f59aad66ed802b746db92ff36b2cfd932b63b528..2e1d2e4433a6f898b7390c0474d83ac961f789e6 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd1.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd1.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) var cmd_subcmd1_cmd1 = &commander.Command{ diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd2.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd2.go index e53134aff8a6a39c6a98bed0c93ff42e5fec0343..78bf3cc5cbb4b70e2dc3c4afd8bdf63c1fe514ef 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd2.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd1_cmd2.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) var cmd_subcmd1_cmd2 = &commander.Command{ diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2.go index d8b42da6fbca89e839abaf6dade4599cce044d9f..57693ac280563f97138eaaa16db1b77c779df9b1 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2.go @@ -1,8 +1,8 @@ package main import ( - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) func ex_make_cmd_subcmd2() *commander.Command { diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd1.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd1.go index e882e09d8baeba6aa2319e1796b5c36cd2082d59..d26ac62f164984a6016442b1e23af98b84e8017e 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd1.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd1.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) func ex_make_cmd_subcmd2_cmd1() *commander.Command { diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd2.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd2.go index aa0fc8cfc545511ac0e110f6e913a73dcd4ace78..07e4fb0733fe7a783dceaed26b23b071e3f5688d 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd2.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/cmd_subcmd2_cmd2.go @@ -3,8 +3,8 @@ package main import ( "fmt" - "github.com/gonuts/commander" - "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) func ex_make_cmd_subcmd2_cmd2() *commander.Command { diff --git a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/main.go b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/main.go index 3a16f609f4324e523f8b9716d735a674fc1cc269..da00a52f0fa4c8fdb6d405847f5ddcdfe2e6397f 100644 --- a/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/main.go +++ b/Godeps/_workspace/src/github.com/gonuts/commander/examples/my-cmd/main.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/gonuts/commander" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" ) var g_cmd = &commander.Command{ diff --git a/Godeps/_workspace/src/github.com/gonuts/flag/flag_test.go b/Godeps/_workspace/src/github.com/gonuts/flag/flag_test.go index d3aa24156d457fc1839239e5de8234f751b5a405..f9bee03cea90e97d8e8737b9d23c212b7889a3a6 100644 --- a/Godeps/_workspace/src/github.com/gonuts/flag/flag_test.go +++ b/Godeps/_workspace/src/github.com/gonuts/flag/flag_test.go @@ -13,7 +13,7 @@ import ( "testing" "time" - . "github.com/gonuts/flag" + . "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) var ( diff --git a/Godeps/_workspace/src/github.com/miekg/dns/.travis.yml b/Godeps/_workspace/src/github.com/miekg/dns/.travis.yml index f0a9d223c3e017a5f69654c8fd2e07c5b82996eb..ff302ef97f639365640e3fd682d53c9acd8cdb14 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/.travis.yml +++ b/Godeps/_workspace/src/github.com/miekg/dns/.travis.yml @@ -1,6 +1,7 @@ language: go +sudo: false go: - - 1.3 - 1.4 + - 1.5 script: - - go test -short -bench=. + - go test -race -bench=. diff --git a/Godeps/_workspace/src/github.com/miekg/dns/README.md b/Godeps/_workspace/src/github.com/miekg/dns/README.md index c2a14316930674490a4998a551d3ac6cd93f71c5..744e20de5f17532c402ce95039c547152d3a5e21 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/README.md +++ b/Godeps/_workspace/src/github.com/miekg/dns/README.md @@ -39,6 +39,10 @@ A not-so-up-to-date-list-that-may-be-actually-current: * https://github.com/tianon/rawdns * https://mesosphere.github.io/mesos-dns/ * https://pulse.turbobytes.com/ +* https://play.google.com/store/apps/details?id=com.turbobytes.dig +* https://github.com/fcambus/statzone +* https://github.com/benschw/dns-clb-go +* https://github.com/corny/dnscheck for http://public-dns.tk/ Send pull request if you want to be listed here. @@ -82,7 +86,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository. *all of them* * 103{4,5} - DNS standard -* 1348 - NSAP record +* 1348 - NSAP record (removed the record) * 1982 - Serial Arithmetic * 1876 - LOC record * 1995 - IXFR @@ -139,7 +143,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository. ## TODO * privatekey.Precompute() when signing? -* Last remaining RRs: APL, ATMA, A6 and NXT. -* Missing in parsing: ISDN, UNSPEC, ATMA. +* Last remaining RRs: APL, ATMA, A6, NSAP and NXT. +* Missing in parsing: ISDN, UNSPEC, NSAP and ATMA. * NSEC(3) cover/match/closest enclose. * Replies with TC bit are not parsed to the end. diff --git a/Godeps/_workspace/src/github.com/miekg/dns/client.go b/Godeps/_workspace/src/github.com/miekg/dns/client.go index 140a7add7b778b645bb48fc69fe6ee1e7779bc71..ea0985194755d503b945d09e2d5059f188c01052 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/client.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/client.go @@ -42,7 +42,7 @@ type Client struct { // // co := &dns.Conn{Conn: c} // c is your net.Conn // co.WriteMsg(m) -// in, err := co.ReadMsg() +// in, err := co.ReadMsg() // co.Close() // func Exchange(m *Msg, a string) (r *Msg, err error) { diff --git a/Godeps/_workspace/src/github.com/miekg/dns/client_test.go b/Godeps/_workspace/src/github.com/miekg/dns/client_test.go index f2ade1485a876e608fce78586c11f1f812cc6e75..4ddd37f74e44877b3a749cdebd402abde7473c6d 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/client_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/client_test.go @@ -88,7 +88,6 @@ func TestClientEDNS0(t *testing.T) { // Validates the transmission and parsing of local EDNS0 options. func TestClientEDNS0Local(t *testing.T) { - optStr1 := "1979:0x0707" optStr2 := strconv.Itoa(EDNS0LOCALSTART) + ":0x0601" @@ -149,65 +148,19 @@ func TestClientEDNS0Local(t *testing.T) { // Validate the local options in the reply. got := r.Extra[1].(*OPT).Option[0].(*EDNS0_LOCAL).String() if got != optStr1 { - t.Log("failed to get local edns0 answer; got %s, expected %s", got, optStr1) + t.Logf("failed to get local edns0 answer; got %s, expected %s", got, optStr1) t.Fail() t.Logf("%v\n", r) } got = r.Extra[1].(*OPT).Option[1].(*EDNS0_LOCAL).String() if got != optStr2 { - t.Log("failed to get local edns0 answer; got %s, expected %s", got, optStr2) + t.Logf("failed to get local edns0 answer; got %s, expected %s", got, optStr2) t.Fail() t.Logf("%v\n", r) } } -func TestSingleSingleInflight(t *testing.T) { - HandleFunc("miek.nl.", HelloServer) - defer HandleRemove("miek.nl.") - - s, addrstr, err := RunLocalUDPServer("127.0.0.1:0") - if err != nil { - t.Fatalf("Unable to run test server: %v", err) - } - defer s.Shutdown() - - m := new(Msg) - m.SetQuestion("miek.nl.", TypeDNSKEY) - - c := new(Client) - c.SingleInflight = true - nr := 10 - ch := make(chan time.Duration) - for i := 0; i < nr; i++ { - go func() { - _, rtt, _ := c.Exchange(m, addrstr) - ch <- rtt - }() - } - i := 0 - var first time.Duration - // With inflight *all* rtt are identical, and by doing actual lookups - // the changes that this is a coincidence is small. -Loop: - for { - select { - case rtt := <-ch: - if i == 0 { - first = rtt - } else { - if first != rtt { - t.Errorf("all rtts should be equal. got %d want %d", rtt, first) - } - } - i++ - if i == 10 { - break Loop - } - } - } -} - // ExampleUpdateLeaseTSIG shows how to update a lease signed with TSIG. func ExampleUpdateLeaseTSIG(t *testing.T) { m := new(Msg) @@ -282,5 +235,4 @@ func TestClientConn(t *testing.T) { if err = r.Unpack(buf); err != nil { t.Errorf("unable to unpack message fully: %v", err) } - } diff --git a/Godeps/_workspace/src/github.com/miekg/dns/defaults.go b/Godeps/_workspace/src/github.com/miekg/dns/defaults.go index 7c5ecae03a1acab97b8bd7bf85b15f7d154bafce..63165b4fa9cecddcd84ddb54aabc8b86f5dc486f 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/defaults.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/defaults.go @@ -150,11 +150,14 @@ func (dns *Msg) IsEdns0() *OPT { return nil } -// IsDomainName checks if s is a valid domainname, it returns -// the number of labels and true, when a domain name is valid. -// Note that non fully qualified domain name is considered valid, in this case the -// last label is counted in the number of labels. -// When false is returned the number of labels is not defined. +// IsDomainName checks if s is a valid domain name, it returns the number of +// labels and true, when a domain name is valid. Note that non fully qualified +// domain name is considered valid, in this case the last label is counted in +// the number of labels. When false is returned the number of labels is not +// defined. Also note that this function is extremely liberal; almost any +// string is a valid domain name as the DNS is 8 bit protocol. It checks if each +// label fits in 63 characters, but there is no length check for the entire +// string s. I.e. a domain name longer than 255 characters is considered valid. func IsDomainName(s string) (labels int, ok bool) { _, labels, err := packDomainName(s, nil, 0, nil, false) return labels, err == nil diff --git a/Godeps/_workspace/src/github.com/miekg/dns/dns.go b/Godeps/_workspace/src/github.com/miekg/dns/dns.go index 1c37a09dd245ff181336acd2084930cb69ca1d55..a3e4a0efae5571867a1b5b85a4b577aa0e3620b3 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/dns.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/dns.go @@ -36,9 +36,7 @@ type RR interface { len() int } -// DNS resource records. -// There are many types of RRs, -// but they all share the same header. +// RR_Header is the header all DNS resource records share. type RR_Header struct { Name string `dns:"cdomain-name"` Rrtype uint16 diff --git a/Godeps/_workspace/src/github.com/miekg/dns/dnssec.go b/Godeps/_workspace/src/github.com/miekg/dns/dnssec.go index 1a993a0e9a3b18812f7327bd4b6eaa6509d504ef..49ab4f1eb6f90bdd6ac830c8b16be403a25dfbfd 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/dnssec.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/dnssec.go @@ -6,14 +6,14 @@ import ( "crypto/dsa" "crypto/ecdsa" "crypto/elliptic" - "crypto/md5" + _ "crypto/md5" + "crypto/rand" "crypto/rsa" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" + _ "crypto/sha1" + _ "crypto/sha256" + _ "crypto/sha512" + "encoding/asn1" "encoding/hex" - "hash" - "io" "math/big" "sort" "strings" @@ -42,6 +42,38 @@ const ( PRIVATEOID uint8 = 254 ) +// Map for algorithm names. +var AlgorithmToString = map[uint8]string{ + RSAMD5: "RSAMD5", + DH: "DH", + DSA: "DSA", + RSASHA1: "RSASHA1", + DSANSEC3SHA1: "DSA-NSEC3-SHA1", + RSASHA1NSEC3SHA1: "RSASHA1-NSEC3-SHA1", + RSASHA256: "RSASHA256", + RSASHA512: "RSASHA512", + ECCGOST: "ECC-GOST", + ECDSAP256SHA256: "ECDSAP256SHA256", + ECDSAP384SHA384: "ECDSAP384SHA384", + INDIRECT: "INDIRECT", + PRIVATEDNS: "PRIVATEDNS", + PRIVATEOID: "PRIVATEOID", +} + +// Map of algorithm strings. +var StringToAlgorithm = reverseInt8(AlgorithmToString) + +// Map of algorithm crypto hashes. +var AlgorithmToHash = map[uint8]crypto.Hash{ + RSAMD5: crypto.MD5, // Deprecated in RFC 6725 + RSASHA1: crypto.SHA1, + RSASHA1NSEC3SHA1: crypto.SHA1, + RSASHA256: crypto.SHA256, + ECDSAP256SHA256: crypto.SHA256, + ECDSAP384SHA384: crypto.SHA384, + RSASHA512: crypto.SHA512, +} + // DNSSEC hashing algorithm codes. const ( _ uint8 = iota @@ -52,6 +84,18 @@ const ( SHA512 // Experimental ) +// Map for hash names. +var HashToString = map[uint8]string{ + SHA1: "SHA1", + SHA256: "SHA256", + GOST94: "GOST94", + SHA384: "SHA384", + SHA512: "SHA512", +} + +// Map of hash strings. +var StringToHash = reverseInt8(HashToString) + // DNSKEY flag values. const ( SEP = 1 @@ -168,24 +212,23 @@ func (k *DNSKEY) ToDS(h uint8) *DS { // digest buffer digest := append(owner, wire...) // another copy + var hash crypto.Hash switch h { case SHA1: - s := sha1.New() - io.WriteString(s, string(digest)) - ds.Digest = hex.EncodeToString(s.Sum(nil)) + hash = crypto.SHA1 case SHA256: - s := sha256.New() - io.WriteString(s, string(digest)) - ds.Digest = hex.EncodeToString(s.Sum(nil)) + hash = crypto.SHA256 case SHA384: - s := sha512.New384() - io.WriteString(s, string(digest)) - ds.Digest = hex.EncodeToString(s.Sum(nil)) - case GOST94: - /* I have no clue */ + hash = crypto.SHA384 + case SHA512: + hash = crypto.SHA512 default: return nil } + + s := hash.New() + s.Write(digest) + ds.Digest = hex.EncodeToString(s.Sum(nil)) return ds } @@ -212,7 +255,7 @@ func (d *DS) ToCDS() *CDS { // There is no check if RRSet is a proper (RFC 2181) RRSet. // If OrigTTL is non zero, it is used as-is, otherwise the TTL of the RRset // is used as the OrigTTL. -func (rr *RRSIG) Sign(k PrivateKey, rrset []RR) error { +func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error { if k == nil { return ErrPrivKey } @@ -258,39 +301,66 @@ func (rr *RRSIG) Sign(k PrivateKey, rrset []RR) error { } signdata = append(signdata, wire...) - var h hash.Hash - switch rr.Algorithm { - case DSA, DSANSEC3SHA1: - // TODO: this seems bugged, will panic - case RSASHA1, RSASHA1NSEC3SHA1: - h = sha1.New() - case RSASHA256, ECDSAP256SHA256: - h = sha256.New() - case ECDSAP384SHA384: - h = sha512.New384() - case RSASHA512: - h = sha512.New() - case RSAMD5: - fallthrough // Deprecated in RFC 6725 - default: + hash, ok := AlgorithmToHash[rr.Algorithm] + if !ok { return ErrAlg } - _, err = h.Write(signdata) - if err != nil { - return err - } - sighash := h.Sum(nil) + h := hash.New() + h.Write(signdata) - signature, err := k.Sign(sighash, rr.Algorithm) + signature, err := sign(k, h.Sum(nil), hash, rr.Algorithm) if err != nil { return err } + rr.Signature = toBase64(signature) return nil } +func sign(k crypto.Signer, hashed []byte, hash crypto.Hash, alg uint8) ([]byte, error) { + signature, err := k.Sign(rand.Reader, hashed, hash) + if err != nil { + return nil, err + } + + switch alg { + case RSASHA1, RSASHA1NSEC3SHA1, RSASHA256, RSASHA512: + return signature, nil + + case ECDSAP256SHA256, ECDSAP384SHA384: + ecdsaSignature := &struct { + R, S *big.Int + }{} + if _, err := asn1.Unmarshal(signature, ecdsaSignature); err != nil { + return nil, err + } + + var intlen int + switch alg { + case ECDSAP256SHA256: + intlen = 32 + case ECDSAP384SHA384: + intlen = 48 + } + + signature := intToBytes(ecdsaSignature.R, intlen) + signature = append(signature, intToBytes(ecdsaSignature.S, intlen)...) + return signature, nil + + // There is no defined interface for what a DSA backed crypto.Signer returns + case DSA, DSANSEC3SHA1: + // t := divRoundUp(divRoundUp(p.PublicKey.Y.BitLen(), 8)-64, 8) + // signature := []byte{byte(t)} + // signature = append(signature, intToBytes(r1, 20)...) + // signature = append(signature, intToBytes(s1, 20)...) + // rr.Signature = signature + } + + return nil, ErrAlg +} + // Verify validates an RRSet with the signature and key. This is only the // cryptographic test, the signature validity period must be checked separately. // This function copies the rdata of some RRs (to lowercase domain names) for the validation to work. @@ -355,6 +425,11 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error { // remove the domain name and assume its our } + hash, ok := AlgorithmToHash[rr.Algorithm] + if !ok { + return ErrAlg + } + switch rr.Algorithm { case RSASHA1, RSASHA1NSEC3SHA1, RSASHA256, RSASHA512, RSAMD5: // TODO(mg): this can be done quicker, ie. cache the pubkey data somewhere?? @@ -362,52 +437,31 @@ func (rr *RRSIG) Verify(k *DNSKEY, rrset []RR) error { if pubkey == nil { return ErrKey } - // Setup the hash as defined for this alg. - var h hash.Hash - var ch crypto.Hash - switch rr.Algorithm { - case RSAMD5: - h = md5.New() - ch = crypto.MD5 - case RSASHA1, RSASHA1NSEC3SHA1: - h = sha1.New() - ch = crypto.SHA1 - case RSASHA256: - h = sha256.New() - ch = crypto.SHA256 - case RSASHA512: - h = sha512.New() - ch = crypto.SHA512 - } - io.WriteString(h, string(signeddata)) - sighash := h.Sum(nil) - return rsa.VerifyPKCS1v15(pubkey, ch, sighash, sigbuf) + + h := hash.New() + h.Write(signeddata) + return rsa.VerifyPKCS1v15(pubkey, hash, h.Sum(nil), sigbuf) + case ECDSAP256SHA256, ECDSAP384SHA384: pubkey := k.publicKeyECDSA() if pubkey == nil { return ErrKey } - var h hash.Hash - switch rr.Algorithm { - case ECDSAP256SHA256: - h = sha256.New() - case ECDSAP384SHA384: - h = sha512.New384() - } - io.WriteString(h, string(signeddata)) - sighash := h.Sum(nil) + // Split sigbuf into the r and s coordinates - r := big.NewInt(0) - r.SetBytes(sigbuf[:len(sigbuf)/2]) - s := big.NewInt(0) - s.SetBytes(sigbuf[len(sigbuf)/2:]) - if ecdsa.Verify(pubkey, sighash, r, s) { + r := new(big.Int).SetBytes(sigbuf[:len(sigbuf)/2]) + s := new(big.Int).SetBytes(sigbuf[len(sigbuf)/2:]) + + h := hash.New() + h.Write(signeddata) + if ecdsa.Verify(pubkey, h.Sum(nil), r, s) { return nil } return ErrSig + + default: + return ErrAlg } - // Unknown alg - return ErrAlg } // ValidityPeriod uses RFC1982 serial arithmetic to calculate @@ -603,36 +657,3 @@ func rawSignatureData(rrset []RR, s *RRSIG) (buf []byte, err error) { } return buf, nil } - -// Map for algorithm names. -var AlgorithmToString = map[uint8]string{ - RSAMD5: "RSAMD5", - DH: "DH", - DSA: "DSA", - RSASHA1: "RSASHA1", - DSANSEC3SHA1: "DSA-NSEC3-SHA1", - RSASHA1NSEC3SHA1: "RSASHA1-NSEC3-SHA1", - RSASHA256: "RSASHA256", - RSASHA512: "RSASHA512", - ECCGOST: "ECC-GOST", - ECDSAP256SHA256: "ECDSAP256SHA256", - ECDSAP384SHA384: "ECDSAP384SHA384", - INDIRECT: "INDIRECT", - PRIVATEDNS: "PRIVATEDNS", - PRIVATEOID: "PRIVATEOID", -} - -// Map of algorithm strings. -var StringToAlgorithm = reverseInt8(AlgorithmToString) - -// Map for hash names. -var HashToString = map[uint8]string{ - SHA1: "SHA1", - SHA256: "SHA256", - GOST94: "GOST94", - SHA384: "SHA384", - SHA512: "SHA512", -} - -// Map of hash strings. -var StringToHash = reverseInt8(HashToString) diff --git a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keygen.go b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keygen.go index 739beebe0682b5d51d085b3284d5680d72e27e73..229a079370b742295b99fe3ee9342b77bfb4fd0d 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keygen.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keygen.go @@ -1,6 +1,7 @@ package dns import ( + "crypto" "crypto/dsa" "crypto/ecdsa" "crypto/elliptic" @@ -15,7 +16,7 @@ import ( // what kind of DNSKEY will be generated. // The ECDSA algorithms imply a fixed keysize, in that case // bits should be set to the size of the algorithm. -func (k *DNSKEY) Generate(bits int) (PrivateKey, error) { +func (k *DNSKEY) Generate(bits int) (crypto.PrivateKey, error) { switch k.Algorithm { case DSA, DSANSEC3SHA1: if bits != 1024 { @@ -52,14 +53,14 @@ func (k *DNSKEY) Generate(bits int) (PrivateKey, error) { return nil, err } k.setPublicKeyDSA(params.Q, params.P, params.G, priv.PublicKey.Y) - return (*DSAPrivateKey)(priv), nil + return priv, nil case RSAMD5, RSASHA1, RSASHA256, RSASHA512, RSASHA1NSEC3SHA1: priv, err := rsa.GenerateKey(rand.Reader, bits) if err != nil { return nil, err } k.setPublicKeyRSA(priv.PublicKey.E, priv.PublicKey.N) - return (*RSAPrivateKey)(priv), nil + return priv, nil case ECDSAP256SHA256, ECDSAP384SHA384: var c elliptic.Curve switch k.Algorithm { @@ -73,7 +74,7 @@ func (k *DNSKEY) Generate(bits int) (PrivateKey, error) { return nil, err } k.setPublicKeyECDSA(priv.PublicKey.X, priv.PublicKey.Y) - return (*ECDSAPrivateKey)(priv), nil + return priv, nil default: return nil, ErrAlg } diff --git a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keyscan.go b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keyscan.go index ac84fbcb4f4e937af279e4196b3474e6facd98f8..19a783389ab2f64c38a9fe650d7322b9d0782fcd 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keyscan.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_keyscan.go @@ -1,6 +1,7 @@ package dns import ( + "crypto" "crypto/dsa" "crypto/ecdsa" "crypto/rsa" @@ -12,7 +13,7 @@ import ( // NewPrivateKey returns a PrivateKey by parsing the string s. // s should be in the same form of the BIND private key files. -func (k *DNSKEY) NewPrivateKey(s string) (PrivateKey, error) { +func (k *DNSKEY) NewPrivateKey(s string) (crypto.PrivateKey, error) { if s[len(s)-1] != '\n' { // We need a closing newline return k.ReadPrivateKey(strings.NewReader(s+"\n"), "") } @@ -23,7 +24,7 @@ func (k *DNSKEY) NewPrivateKey(s string) (PrivateKey, error) { // only used in error reporting. // The public key must be known, because some cryptographic algorithms embed // the public inside the privatekey. -func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (PrivateKey, error) { +func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (crypto.PrivateKey, error) { m, e := parseKey(q, file) if m == nil { return nil, e @@ -50,7 +51,7 @@ func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (PrivateKey, error) { return nil, ErrKey } priv.PublicKey = *pub - return (*DSAPrivateKey)(priv), e + return priv, e case RSAMD5: fallthrough case RSASHA1: @@ -69,7 +70,7 @@ func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (PrivateKey, error) { return nil, ErrKey } priv.PublicKey = *pub - return (*RSAPrivateKey)(priv), e + return priv, e case ECCGOST: return nil, ErrPrivKey case ECDSAP256SHA256: @@ -84,7 +85,7 @@ func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (PrivateKey, error) { return nil, ErrKey } priv.PublicKey = *pub - return (*ECDSAPrivateKey)(priv), e + return priv, e default: return nil, ErrPrivKey } diff --git a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_privkey.go b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_privkey.go index 0b8f282b6388088d2cdbbca6f46c23dd68b99e3e..56f3ea934f63f731de101a729d40350006bc1956 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_privkey.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_privkey.go @@ -4,7 +4,6 @@ import ( "crypto" "crypto/dsa" "crypto/ecdsa" - "crypto/rand" "crypto/rsa" "math/big" "strconv" @@ -12,133 +11,75 @@ import ( const format = "Private-key-format: v1.3\n" -// PrivateKey ... TODO(miek) -type PrivateKey interface { - Sign([]byte, uint8) ([]byte, error) - String(uint8) string -} - // PrivateKeyString converts a PrivateKey to a string. This string has the same // format as the private-key-file of BIND9 (Private-key-format: v1.3). -// It needs some info from the key (the algorithm), so its a method of the -// DNSKEY and calls PrivateKey.String(alg). -func (r *DNSKEY) PrivateKeyString(p PrivateKey) string { - return p.String(r.Algorithm) -} +// It needs some info from the key (the algorithm), so its a method of the DNSKEY +// It supports rsa.PrivateKey, ecdsa.PrivateKey and dsa.PrivateKey +func (r *DNSKEY) PrivateKeyString(p crypto.PrivateKey) string { + algorithm := strconv.Itoa(int(r.Algorithm)) + algorithm += " (" + AlgorithmToString[r.Algorithm] + ")" -type RSAPrivateKey rsa.PrivateKey + switch p := p.(type) { + case *rsa.PrivateKey: + modulus := toBase64(p.PublicKey.N.Bytes()) + e := big.NewInt(int64(p.PublicKey.E)) + publicExponent := toBase64(e.Bytes()) + privateExponent := toBase64(p.D.Bytes()) + prime1 := toBase64(p.Primes[0].Bytes()) + prime2 := toBase64(p.Primes[1].Bytes()) + // Calculate Exponent1/2 and Coefficient as per: http://en.wikipedia.org/wiki/RSA#Using_the_Chinese_remainder_algorithm + // and from: http://code.google.com/p/go/issues/detail?id=987 + one := big.NewInt(1) + p1 := big.NewInt(0).Sub(p.Primes[0], one) + q1 := big.NewInt(0).Sub(p.Primes[1], one) + exp1 := big.NewInt(0).Mod(p.D, p1) + exp2 := big.NewInt(0).Mod(p.D, q1) + coeff := big.NewInt(0).ModInverse(p.Primes[1], p.Primes[0]) -func (p *RSAPrivateKey) Sign(hashed []byte, alg uint8) ([]byte, error) { - var hash crypto.Hash - switch alg { - case RSASHA1, RSASHA1NSEC3SHA1: - hash = crypto.SHA1 - case RSASHA256: - hash = crypto.SHA256 - case RSASHA512: - hash = crypto.SHA512 - default: - return nil, ErrAlg - } - return rsa.SignPKCS1v15(nil, (*rsa.PrivateKey)(p), hash, hashed) -} - -func (p *RSAPrivateKey) String(alg uint8) string { - algorithm := strconv.Itoa(int(alg)) + " (" + AlgorithmToString[alg] + ")" - modulus := toBase64(p.PublicKey.N.Bytes()) - e := big.NewInt(int64(p.PublicKey.E)) - publicExponent := toBase64(e.Bytes()) - privateExponent := toBase64(p.D.Bytes()) - prime1 := toBase64(p.Primes[0].Bytes()) - prime2 := toBase64(p.Primes[1].Bytes()) - // Calculate Exponent1/2 and Coefficient as per: http://en.wikipedia.org/wiki/RSA#Using_the_Chinese_remainder_algorithm - // and from: http://code.google.com/p/go/issues/detail?id=987 - one := big.NewInt(1) - p1 := big.NewInt(0).Sub(p.Primes[0], one) - q1 := big.NewInt(0).Sub(p.Primes[1], one) - exp1 := big.NewInt(0).Mod(p.D, p1) - exp2 := big.NewInt(0).Mod(p.D, q1) - coeff := big.NewInt(0).ModInverse(p.Primes[1], p.Primes[0]) + exponent1 := toBase64(exp1.Bytes()) + exponent2 := toBase64(exp2.Bytes()) + coefficient := toBase64(coeff.Bytes()) - exponent1 := toBase64(exp1.Bytes()) - exponent2 := toBase64(exp2.Bytes()) - coefficient := toBase64(coeff.Bytes()) + return format + + "Algorithm: " + algorithm + "\n" + + "Modulus: " + modulus + "\n" + + "PublicExponent: " + publicExponent + "\n" + + "PrivateExponent: " + privateExponent + "\n" + + "Prime1: " + prime1 + "\n" + + "Prime2: " + prime2 + "\n" + + "Exponent1: " + exponent1 + "\n" + + "Exponent2: " + exponent2 + "\n" + + "Coefficient: " + coefficient + "\n" - return format + - "Algorithm: " + algorithm + "\n" + - "Modulus: " + modulus + "\n" + - "PublicExponent: " + publicExponent + "\n" + - "PrivateExponent: " + privateExponent + "\n" + - "Prime1: " + prime1 + "\n" + - "Prime2: " + prime2 + "\n" + - "Exponent1: " + exponent1 + "\n" + - "Exponent2: " + exponent2 + "\n" + - "Coefficient: " + coefficient + "\n" -} + case *ecdsa.PrivateKey: + var intlen int + switch r.Algorithm { + case ECDSAP256SHA256: + intlen = 32 + case ECDSAP384SHA384: + intlen = 48 + } + private := toBase64(intToBytes(p.D, intlen)) + return format + + "Algorithm: " + algorithm + "\n" + + "PrivateKey: " + private + "\n" -type ECDSAPrivateKey ecdsa.PrivateKey + case *dsa.PrivateKey: + T := divRoundUp(divRoundUp(p.PublicKey.Parameters.G.BitLen(), 8)-64, 8) + prime := toBase64(intToBytes(p.PublicKey.Parameters.P, 64+T*8)) + subprime := toBase64(intToBytes(p.PublicKey.Parameters.Q, 20)) + base := toBase64(intToBytes(p.PublicKey.Parameters.G, 64+T*8)) + priv := toBase64(intToBytes(p.X, 20)) + pub := toBase64(intToBytes(p.PublicKey.Y, 64+T*8)) + return format + + "Algorithm: " + algorithm + "\n" + + "Prime(p): " + prime + "\n" + + "Subprime(q): " + subprime + "\n" + + "Base(g): " + base + "\n" + + "Private_value(x): " + priv + "\n" + + "Public_value(y): " + pub + "\n" -func (p *ECDSAPrivateKey) Sign(hashed []byte, alg uint8) ([]byte, error) { - var intlen int - switch alg { - case ECDSAP256SHA256: - intlen = 32 - case ECDSAP384SHA384: - intlen = 48 default: - return nil, ErrAlg - } - r1, s1, err := ecdsa.Sign(rand.Reader, (*ecdsa.PrivateKey)(p), hashed) - if err != nil { - return nil, err + return "" } - signature := intToBytes(r1, intlen) - signature = append(signature, intToBytes(s1, intlen)...) - return signature, nil -} - -func (p *ECDSAPrivateKey) String(alg uint8) string { - algorithm := strconv.Itoa(int(alg)) + " (" + AlgorithmToString[alg] + ")" - var intlen int - switch alg { - case ECDSAP256SHA256: - intlen = 32 - case ECDSAP384SHA384: - intlen = 48 - } - private := toBase64(intToBytes(p.D, intlen)) - return format + - "Algorithm: " + algorithm + "\n" + - "PrivateKey: " + private + "\n" -} - -type DSAPrivateKey dsa.PrivateKey - -func (p *DSAPrivateKey) Sign(hashed []byte, alg uint8) ([]byte, error) { - r1, s1, err := dsa.Sign(rand.Reader, (*dsa.PrivateKey)(p), hashed) - if err != nil { - return nil, err - } - t := divRoundUp(divRoundUp(p.PublicKey.Y.BitLen(), 8)-64, 8) - signature := []byte{byte(t)} - signature = append(signature, intToBytes(r1, 20)...) - signature = append(signature, intToBytes(s1, 20)...) - return signature, nil -} - -func (p *DSAPrivateKey) String(alg uint8) string { - algorithm := strconv.Itoa(int(alg)) + " (" + AlgorithmToString[alg] + ")" - T := divRoundUp(divRoundUp(p.PublicKey.Parameters.G.BitLen(), 8)-64, 8) - prime := toBase64(intToBytes(p.PublicKey.Parameters.P, 64+T*8)) - subprime := toBase64(intToBytes(p.PublicKey.Parameters.Q, 20)) - base := toBase64(intToBytes(p.PublicKey.Parameters.G, 64+T*8)) - priv := toBase64(intToBytes(p.X, 20)) - pub := toBase64(intToBytes(p.PublicKey.Y, 64+T*8)) - return format + - "Algorithm: " + algorithm + "\n" + - "Prime(p): " + prime + "\n" + - "Subprime(q): " + subprime + "\n" + - "Base(g): " + base + "\n" + - "Private_value(x): " + priv + "\n" + - "Public_value(y): " + pub + "\n" } diff --git a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_test.go b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_test.go index 0975ed507c6837110887e56ea1321d338852d626..839aa386ced04addb333ad971c9962dd3c572523 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/dnssec_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/dnssec_test.go @@ -1,6 +1,9 @@ package dns import ( + "crypto" + "crypto/ecdsa" + "crypto/rsa" "reflect" "strings" "testing" @@ -192,7 +195,7 @@ func TestSignVerify(t *testing.T) { sig.Algorithm = RSASHA256 for _, r := range []RR{soa, soa1, srv} { - if sig.Sign(privkey, []RR{r}) != nil { + if sig.Sign(privkey.(*rsa.PrivateKey), []RR{r}) != nil { t.Error("failure to sign the record") continue } @@ -228,7 +231,7 @@ func Test65534(t *testing.T) { sig.KeyTag = key.KeyTag() sig.SignerName = key.Hdr.Name sig.Algorithm = RSASHA256 - if err := sig.Sign(privkey, []RR{t6}); err != nil { + if err := sig.Sign(privkey.(*rsa.PrivateKey), []RR{t6}); err != nil { t.Error(err) t.Error("failure to sign the TYPE65534 record") } @@ -324,7 +327,7 @@ func TestKeyRSA(t *testing.T) { sig.KeyTag = key.KeyTag() sig.SignerName = key.Hdr.Name - if err := sig.Sign(priv, []RR{soa}); err != nil { + if err := sig.Sign(priv.(*rsa.PrivateKey), []RR{soa}); err != nil { t.Error("failed to sign") return } @@ -374,7 +377,7 @@ Activate: 20110302104537` t.Error(err) } switch priv := p.(type) { - case *RSAPrivateKey: + case *rsa.PrivateKey: if 65537 != priv.PublicKey.E { t.Error("exponenent should be 65537") } @@ -403,7 +406,7 @@ Activate: 20110302104537` sig.SignerName = k.Hdr.Name sig.Algorithm = k.Algorithm - sig.Sign(p, []RR{soa}) + sig.Sign(p.(*rsa.PrivateKey), []RR{soa}) if sig.Signature != "D5zsobpQcmMmYsUMLxCVEtgAdCvTu8V/IEeP4EyLBjqPJmjt96bwM9kqihsccofA5LIJ7DN91qkCORjWSTwNhzCv7bMyr2o5vBZElrlpnRzlvsFIoAZCD9xg6ZY7ZyzUJmU6IcTwG4v3xEYajcpbJJiyaw/RqR90MuRdKPiBzSo=" { t.Errorf("signature is not correct: %v", sig) } @@ -443,7 +446,7 @@ PrivateKey: WURgWHCcYIYUPWgeLmiPY2DJJk02vgrmTfitxgqcL4vwW7BOrbawVmVe0d9V94SR` sig.SignerName = eckey.(*DNSKEY).Hdr.Name sig.Algorithm = eckey.(*DNSKEY).Algorithm - if sig.Sign(privkey, []RR{a}) != nil { + if sig.Sign(privkey.(*ecdsa.PrivateKey), []RR{a}) != nil { t.Fatal("failure to sign the record") } @@ -491,7 +494,7 @@ func TestSignVerifyECDSA2(t *testing.T) { sig.SignerName = key.Hdr.Name sig.Algorithm = ECDSAP256SHA256 - if sig.Sign(privkey, []RR{srv}) != nil { + if sig.Sign(privkey.(*ecdsa.PrivateKey), []RR{srv}) != nil { t.Fatal("failure to sign the record") } @@ -564,7 +567,7 @@ PrivateKey: GU6SnQ/Ou+xC5RumuIUIuJZteXT2z0O/ok1s38Et6mQ=` } ourRRSIG.Expiration, _ = StringToTime("20100909100439") ourRRSIG.Inception, _ = StringToTime("20100812100439") - err = ourRRSIG.Sign(priv, []RR{rrA}) + err = ourRRSIG.Sign(priv.(*ecdsa.PrivateKey), []RR{rrA}) if err != nil { t.Fatal(err) } @@ -640,7 +643,7 @@ PrivateKey: WURgWHCcYIYUPWgeLmiPY2DJJk02vgrmTfitxgqcL4vwW7BOrbawVmVe0d9V94SR` } ourRRSIG.Expiration, _ = StringToTime("20100909102025") ourRRSIG.Inception, _ = StringToTime("20100812102025") - err = ourRRSIG.Sign(priv, []RR{rrA}) + err = ourRRSIG.Sign(priv.(*ecdsa.PrivateKey), []RR{rrA}) if err != nil { t.Fatal(err) } @@ -709,7 +712,7 @@ func TestInvalidRRSet(t *testing.T) { } // Sign the good record set and then make sure verification fails on the bad record set - if err := signature.Sign(privatekey, goodRecords); err != nil { + if err := signature.Sign(privatekey.(crypto.Signer), goodRecords); err != nil { t.Fatal("Signing good records failed") } diff --git a/Godeps/_workspace/src/github.com/miekg/dns/doc.go b/Godeps/_workspace/src/github.com/miekg/dns/doc.go index 34d59ab144886e5cec33f76523552ffd591f88e2..89eace59de904da069a18a2be7dc46abfb58b590 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/doc.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/doc.go @@ -13,7 +13,8 @@ Resource records are native types. They are not stored in wire format. Basic usage pattern for creating a new resource record: r := new(dns.MX) - r.Hdr = dns.RR_Header{Name: "miek.nl.", Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 3600} + r.Hdr = dns.RR_Header{Name: "miek.nl.", Rrtype: dns.TypeMX, + Class: dns.ClassINET, Ttl: 3600} r.Preference = 10 r.Mx = "mx.miek.nl." @@ -57,8 +58,8 @@ server configured on 127.0.0.1 and port 53: c := new(dns.Client) in, rtt, err := c.Exchange(m1, "127.0.0.1:53") -Suppressing -multiple outstanding queries (with the same question, type and class) is as easy as setting: +Suppressing multiple outstanding queries (with the same question, type and +class) is as easy as setting: c.SingleInflight = true @@ -118,7 +119,7 @@ certain resource records or names in a zone to specify if resource records should be added or removed. The table from RFC 2136 supplemented with the Go DNS function shows which functions exist to specify the prerequisites. -3.2.4 - Table Of Metavalues Used In Prerequisite Section + 3.2.4 - Table Of Metavalues Used In Prerequisite Section CLASS TYPE RDATA Meaning Function -------------------------------------------------------------- @@ -133,7 +134,7 @@ If you have decided on the prerequisites you can tell what RRs should be added or deleted. The next table shows the options you have and what functions to call. -3.4.2.6 - Table Of Metavalues Used In Update Section + 3.4.2.6 - Table Of Metavalues Used In Update Section CLASS TYPE RDATA Meaning Function --------------------------------------------------------------- @@ -183,7 +184,7 @@ Basic use pattern validating and replying to a message that has TSIG set. dns.HandleFunc(".", handleRequest) func handleRequest(w dns.ResponseWriter, r *dns.Msg) { - m := new(Msg) + m := new(dns.Msg) m.SetReply(r) if r.IsTsig() { if w.TsigStatus() == nil { diff --git a/Godeps/_workspace/src/github.com/miekg/dns/edns.go b/Godeps/_workspace/src/github.com/miekg/dns/edns.go index 5314c543b08abeb2d132767cfa472a12313fe57f..87c8affec2d214ed6551e417cd8a0b63f4a5ab27 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/edns.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/edns.go @@ -30,6 +30,7 @@ type OPT struct { Option []EDNS0 `dns:"opt"` } +// Header implements the RR interface. func (rr *OPT) Header() *RR_Header { return &rr.Hdr } @@ -176,7 +177,7 @@ func (e *EDNS0_NSID) Option() uint16 { return EDNS0NSID } func (e *EDNS0_NSID) unpack(b []byte) error { e.Nsid = hex.EncodeToString(b); return nil } func (e *EDNS0_NSID) String() string { return string(e.Nsid) } -// The subnet EDNS0 option is used to give the remote nameserver +// EDNS0_SUBNET is the subnet option that is used to give the remote nameserver // an idea of where the client lives. It can then give back a different // answer depending on the location or network topology. // Basic use pattern for creating an subnet option: @@ -291,7 +292,7 @@ func (e *EDNS0_SUBNET) String() (s string) { return } -// The UL (Update Lease) EDNS0 (draft RFC) option is used to tell the server to set +// The EDNS0_UL (Update Lease) (draft RFC) option is used to tell the server to set // an expiration on an update RR. This is helpful for clients that cannot clean // up after themselves. This is a draft RFC and more information can be found at // http://files.dns-sd.org/draft-sekar-dns-ul.txt @@ -329,7 +330,7 @@ func (e *EDNS0_UL) unpack(b []byte) error { return nil } -// Long Lived Queries: http://tools.ietf.org/html/draft-sekar-dns-llq-01 +// EDNS0_LLQ stands for Long Lived Queries: http://tools.ietf.org/html/draft-sekar-dns-llq-01 // Implemented for completeness, as the EDNS0 type code is assigned. type EDNS0_LLQ struct { Code uint16 // Always EDNS0LLQ @@ -471,7 +472,7 @@ func (e *EDNS0_EXPIRE) unpack(b []byte) error { return nil } -// The local EDNS0 option is used for local/experimental purposes. The option +// The EDNS0_LOCAL option is used for local/experimental purposes. The option // code is recommended to be within the range [EDNS0LOCALSTART, EDNS0LOCALEND] // (RFC6891), although any unassigned code can actually be used. The content of // the option is made available in Data, unaltered. diff --git a/Godeps/_workspace/src/github.com/miekg/dns/example_test.go b/Godeps/_workspace/src/github.com/miekg/dns/example_test.go index 1578a4d0539b329618d94602680e90704728503e..d62a80d619eb3021ed024f558045fe381096f51a 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/example_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/example_test.go @@ -3,7 +3,7 @@ package dns_test import ( "errors" "fmt" - "github.com/miekg/dns" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/miekg/dns" "log" "net" ) diff --git a/Godeps/_workspace/src/github.com/miekg/dns/fuzz_test.go b/Godeps/_workspace/src/github.com/miekg/dns/fuzz_test.go new file mode 100644 index 0000000000000000000000000000000000000000..255869730e68022830dd72eacb4f8afd4e0f78ef --- /dev/null +++ b/Godeps/_workspace/src/github.com/miekg/dns/fuzz_test.go @@ -0,0 +1,25 @@ +package dns + +import "testing" + +func TestFuzzString(t *testing.T) { + testcases := []string{"", " MINFO ", " RP ", " NSEC 0 0", " \" NSEC 0 0\"", " \" MINFO \"", + ";a ", ";a����������", + " NSAP O ", " NSAP N ", + " TYPE4 TYPE6a789a3bc0045c8a5fb42c7d1bd998f5444 IN 9579b47d46817afbd17273e6", + " TYPE45 3 3 4147994 TYPE\\(\\)\\)\\(\\)\\(\\(\\)\\(\\)\\)\\)\\(\\)\\(\\)\\(\\(\\R 948\"\")\\(\\)\\)\\)\\(\\ ", + "$GENERATE 0-3 ${441189,5039418474430,o}", + "$INCLUDE 00 TYPE00000000000n ", + "$INCLUDE PE4 TYPE061463623/727071511 \\(\\)\\$GENERATE 6-462/0", + } + for i, tc := range testcases { + rr, err := NewRR(tc) + if err == nil { + // rr can be nil because we can (for instance) just parse a comment + if rr == nil { + continue + } + t.Fatalf("parsed mailformed RR %d: %s", i, rr.String()) + } + } +} diff --git a/Godeps/_workspace/src/github.com/miekg/dns/idn/example_test.go b/Godeps/_workspace/src/github.com/miekg/dns/idn/example_test.go index 8833cd91de138e988b0e7d34c71422f5cc76ab08..6917ed9288df613e672db064a36d0d8ee05c93b5 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/idn/example_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/idn/example_test.go @@ -2,7 +2,7 @@ package idn_test import ( "fmt" - "github.com/miekg/dns/idn" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/miekg/dns/idn" ) func ExampleToPunycode() { diff --git a/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode.go b/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode.go index 09363821b10dab80a33047e42fde2d03bb7f79b6..3487f26368410650a21b01a7340c67b835e9e308 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode.go @@ -5,8 +5,9 @@ import ( "bytes" "strings" "unicode" + "unicode/utf8" - "github.com/miekg/dns" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/miekg/dns" ) // Implementation idea from RFC itself and from from IDNA::Punycode created by @@ -27,9 +28,15 @@ const ( ) // ToPunycode converts unicode domain names to DNS-appropriate punycode names. -// This function would return an empty string result for domain names with +// This function will return an empty string result for domain names with // invalid unicode strings. This function expects domain names in lowercase. func ToPunycode(s string) string { + // Early check to see if encoding is needed. + // This will prevent making heap allocations when not needed. + if !needToPunycode(s) { + return s + } + tokens := dns.SplitDomainName(s) switch { case s == "": @@ -51,7 +58,14 @@ func ToPunycode(s string) string { } // FromPunycode returns unicode domain name from provided punycode string. +// This function expects punycode strings in lowercase. func FromPunycode(s string) string { + // Early check to see if decoding is needed. + // This will prevent making heap allocations when not needed. + if !needFromPunycode(s) { + return s + } + tokens := dns.SplitDomainName(s) switch { case s == "": @@ -124,7 +138,7 @@ func next(b []rune, boundary rune) rune { } // preprune converts unicode rune to lower case. At this time it's not -// supporting all things described in RFCs +// supporting all things described in RFCs. func preprune(r rune) rune { if unicode.IsUpper(r) { r = unicode.ToLower(r) @@ -132,7 +146,7 @@ func preprune(r rune) rune { return r } -// tfunc is a function that helps calculate each character weight +// tfunc is a function that helps calculate each character weight. func tfunc(k, bias rune) rune { switch { case k <= bias: @@ -143,6 +157,51 @@ func tfunc(k, bias rune) rune { return k - bias } +// needToPunycode returns true for strings that require punycode encoding +// (contain unicode characters). +func needToPunycode(s string) bool { + // This function is very similar to bytes.Runes. We don't use bytes.Runes + // because it makes a heap allocation that's not needed here. + for i := 0; len(s) > 0; i++ { + r, l := utf8.DecodeRuneInString(s) + if r > 0x7f { + return true + } + s = s[l:] + } + return false +} + +// needFromPunycode returns true for strings that require punycode decoding. +func needFromPunycode(s string) bool { + if s == "." { + return false + } + + off := 0 + end := false + pl := len(_PREFIX) + sl := len(s) + + // If s starts with _PREFIX. + if sl > pl && s[off:off+pl] == _PREFIX { + return true + } + + for { + // Find the part after the next ".". + off, end = dns.NextLabel(s, off) + if end { + return false + } + // If this parts starts with _PREFIX. + if sl-off > pl && s[off:off+pl] == _PREFIX { + return true + } + } + panic("dns: not reached") +} + // encode transforms Unicode input bytes (that represent DNS label) into // punycode bytestream. This function would return nil if there's an invalid // character in the label. @@ -217,7 +276,7 @@ func encode(input []byte) []byte { return out.Bytes() } -// decode transforms punycode input bytes (that represent DNS label) into Unicode bytestream +// decode transforms punycode input bytes (that represent DNS label) into Unicode bytestream. func decode(b []byte) []byte { src := b // b would move and we need to keep it @@ -254,6 +313,10 @@ func decode(b []byte) []byte { return src } i += digit * w + if i < 0 { + // safety check for rune overflow + return src + } t = tfunc(k, bias) if digit < t { diff --git a/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode_test.go b/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode_test.go index f8b355ca7231c584048886a9ff3e86b7615a3ba5..9c9a15f0ba1d263b70fe8d5878e80417b8774e92 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/idn/punycode_test.go @@ -8,9 +8,9 @@ import ( var testcases = [][2]string{ {"", ""}, {"a", "a"}, - {"A-B", "a-b"}, - {"A-B-C", "a-b-c"}, - {"AbC", "abc"}, + {"a-b", "a-b"}, + {"a-b-c", "a-b-c"}, + {"abc", "abc"}, {"я", "xn--41a"}, {"zя", "xn--z-0ub"}, {"яZ", "xn--z-zub"}, @@ -86,6 +86,7 @@ var invalidACEs = []string{ "xn--*", "xn--", "xn---", + "xn--a000000000", } func TestInvalidPunycode(t *testing.T) { diff --git a/Godeps/_workspace/src/github.com/miekg/dns/labels.go b/Godeps/_workspace/src/github.com/miekg/dns/labels.go index 758e5783de5a83d5da629712f633552060e955fb..3944dd0632ffaf6a4117cd49696df1124861eedb 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/labels.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/labels.go @@ -98,12 +98,11 @@ func CountLabel(s string) (labels int) { return } } - panic("dns: not reached") } // Split splits a name s into its label indexes. // www.miek.nl. returns []int{0, 4, 9}, www.miek.nl also returns []int{0, 4, 9}. -// The root name (.) returns nil. Also see dns.SplitDomainName. +// The root name (.) returns nil. Also see SplitDomainName. func Split(s string) []int { if s == "." { return nil @@ -119,12 +118,12 @@ func Split(s string) []int { } idx = append(idx, off) } - panic("dns: not reached") } // NextLabel returns the index of the start of the next label in the // string s starting at offset. // The bool end is true when the end of the string has been reached. +// Also see PrevLabel. func NextLabel(s string, offset int) (i int, end bool) { quote := false for i = offset; i < len(s)-1; i++ { @@ -147,6 +146,7 @@ func NextLabel(s string, offset int) (i int, end bool) { // PrevLabel returns the index of the label when starting from the right and // jumping n labels to the left. // The bool start is true when the start of the string has been overshot. +// Also see NextLabel. func PrevLabel(s string, n int) (i int, start bool) { if n == 0 { return len(s), false diff --git a/Godeps/_workspace/src/github.com/miekg/dns/msg.go b/Godeps/_workspace/src/github.com/miekg/dns/msg.go index 01dafde90da1766e42a02ec60518276d7f268acf..3d13135c69000e59fbf1bb257bebe10a4e746bf6 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/msg.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/msg.go @@ -29,8 +29,6 @@ var ( ErrAuth error = &Error{err: "bad authentication"} // ErrBuf indicates that the buffer used it too small for the message. ErrBuf error = &Error{err: "buffer size too small"} - // ErrConn indicates that a connection has both a TCP and UDP socket. - ErrConn error = &Error{err: "conn holds both UDP and TCP connection"} // ErrConnEmpty indicates a connection is being uses before it is initialized. ErrConnEmpty error = &Error{err: "conn has no connection"} // ErrExtendedRcode ... @@ -38,7 +36,8 @@ var ( // ErrFqdn indicates that a domain name does not have a closing dot. ErrFqdn error = &Error{err: "domain must be fully qualified"} // ErrId indicates there is a mismatch with the message's ID. - ErrId error = &Error{err: "id mismatch"} + ErrId error = &Error{err: "id mismatch"} + // ErrKeyAlg indicates that the algorithm in the key is not valid. ErrKeyAlg error = &Error{err: "bad key algorithm"} ErrKey error = &Error{err: "bad key"} ErrKeySize error = &Error{err: "bad key size"} @@ -51,8 +50,6 @@ var ( ErrShortRead error = &Error{err: "short read"} // ErrSig indicates that a signature can not be cryptographically validated. ErrSig error = &Error{err: "bad signature"} - // ErrSigGen indicates a faulure to generate a signature. - ErrSigGen error = &Error{err: "bad signature generation"} // ErrSOA indicates that no SOA RR was seen when doing zone transfers. ErrSoa error = &Error{err: "no SOA"} // ErrTime indicates a timing error in TSIG authentication. @@ -138,7 +135,6 @@ var TypeToString = map[uint16]string{ TypeNINFO: "NINFO", TypeNIMLOC: "NIMLOC", TypeNS: "NS", - TypeNSAP: "NSAP", TypeNSAPPTR: "NSAP-PTR", TypeNSEC3: "NSEC3", TypeNSEC3PARAM: "NSEC3PARAM", @@ -237,7 +233,7 @@ var RcodeToString = map[int]string{ // PackDomainName packs a domain name s into msg[off:]. // If compression is wanted compress must be true and the compression // map needs to hold a mapping between domain names and offsets -// pointing into msg[]. +// pointing into msg. func PackDomainName(s string, msg []byte, off int, compression map[string]int, compress bool) (off1 int, err error) { off1, _, err = packDomainName(s, msg, off, compression, compress) return @@ -1701,6 +1697,9 @@ func (dns *Msg) Unpack(msg []byte) (err error) { // an error, because technically it isn't an error. So return // without parsing the potentially corrupt packet and hitting an error. // TODO(miek): this isn't the best strategy! + // Better stragey would be: set boolean indicating truncated message, go forth and parse + // until we hit an error, return the message without the latest parsed rr if this boolean + // is true. if dns.Truncated { dns.Answer = nil dns.Ns = nil diff --git a/Godeps/_workspace/src/github.com/miekg/dns/parse_test.go b/Godeps/_workspace/src/github.com/miekg/dns/parse_test.go index 61c4581e78411dd7f6654c3cfc71b2c9911bd4af..1bf4d87151f53b3fef9e447293f3b3ddc756f36c 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/parse_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/parse_test.go @@ -905,16 +905,13 @@ func TestILNP(t *testing.T) { } } -func TestNsapGposEidNimloc(t *testing.T) { +func TestGposEidNimloc(t *testing.T) { dt := map[string]string{ - "foo.bar.com. IN NSAP 21 47000580ffff000000321099991111222233334444": "foo.bar.com.\t3600\tIN\tNSAP\t0x47000580ffff000000321099991111222233334444", - "foo.bar.com. IN NSAP 0x47000580ffff000000321099991111222233334444": "foo.bar.com.\t3600\tIN\tNSAP\t0x47000580ffff000000321099991111222233334444", - "host.school.de IN NSAP 17 39276f3100111100002222333344449876": "host.school.de.\t3600\tIN\tNSAP\t0x39276f3100111100002222333344449876", - "444433332222111199990123000000ff. NSAP-PTR foo.bar.com.": "444433332222111199990123000000ff.\t3600\tIN\tNSAP-PTR\tfoo.bar.com.", - "lillee. IN GPOS -32.6882 116.8652 10.0": "lillee.\t3600\tIN\tGPOS\t-32.6882 116.8652 10.0", - "hinault. IN GPOS -22.6882 116.8652 250.0": "hinault.\t3600\tIN\tGPOS\t-22.6882 116.8652 250.0", - "VENERA. IN NIMLOC 75234159EAC457800920": "VENERA.\t3600\tIN\tNIMLOC\t75234159EAC457800920", - "VAXA. IN EID 3141592653589793": "VAXA.\t3600\tIN\tEID\t3141592653589793", + "444433332222111199990123000000ff. NSAP-PTR foo.bar.com.": "444433332222111199990123000000ff.\t3600\tIN\tNSAP-PTR\tfoo.bar.com.", + "lillee. IN GPOS -32.6882 116.8652 10.0": "lillee.\t3600\tIN\tGPOS\t-32.6882 116.8652 10.0", + "hinault. IN GPOS -22.6882 116.8652 250.0": "hinault.\t3600\tIN\tGPOS\t-22.6882 116.8652 250.0", + "VENERA. IN NIMLOC 75234159EAC457800920": "VENERA.\t3600\tIN\tNIMLOC\t75234159EAC457800920", + "VAXA. IN EID 3141592653589793": "VAXA.\t3600\tIN\tEID\t3141592653589793", } for i, o := range dt { rr, err := NewRR(i) @@ -1240,8 +1237,8 @@ func TestNewPrivateKey(t *testing.T) { } switch newPrivKey := newPrivKey.(type) { - case *RSAPrivateKey: - (*rsa.PrivateKey)(newPrivKey).Precompute() + case *rsa.PrivateKey: + newPrivKey.Precompute() } if !reflect.DeepEqual(privkey, newPrivKey) { @@ -1510,7 +1507,7 @@ func TestPackCAA(t *testing.T) { func TestParseURI(t *testing.T) { lt := map[string]string{ "_http._tcp. IN URI 10 1 \"http://www.example.com/path\"": "_http._tcp.\t3600\tIN\tURI\t10 1 \"http://www.example.com/path\"", - "_http._tcp. IN URI 10 1 \"\"": "_http._tcp.\t3600\tIN\tURI\t10 1 \"\"", + "_http._tcp. IN URI 10 1 \"\"": "_http._tcp.\t3600\tIN\tURI\t10 1 \"\"", } for i, o := range lt { rr, err := NewRR(i) diff --git a/Godeps/_workspace/src/github.com/miekg/dns/privaterr.go b/Godeps/_workspace/src/github.com/miekg/dns/privaterr.go index a3baa065593b024561fcf18a23c44706804e9d65..7290791be35bf59ba917bba1dc3bd7f41bb70c52 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/privaterr.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/privaterr.go @@ -46,8 +46,10 @@ func mkPrivateRR(rrtype uint16) *PrivateRR { panic(fmt.Sprintf("dns: RR is not a PrivateRR, typeToRR[%d] generator returned %T", rrtype, anyrr)) } +// Header return the RR header of r. func (r *PrivateRR) Header() *RR_Header { return &r.Hdr } -func (r *PrivateRR) String() string { return r.Hdr.String() + r.Data.String() } + +func (r *PrivateRR) String() string { return r.Hdr.String() + r.Data.String() } // Private len and copy parts to satisfy RR interface. func (r *PrivateRR) len() int { return r.Hdr.len() + r.Data.Len() } diff --git a/Godeps/_workspace/src/github.com/miekg/dns/privaterr_test.go b/Godeps/_workspace/src/github.com/miekg/dns/privaterr_test.go index d45084c6897eaa50780e482870def54b57fa27c5..5c44d1f35c180de8a3f98448ece2838730c22a7d 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/privaterr_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/privaterr_test.go @@ -4,7 +4,7 @@ import ( "strings" "testing" - "github.com/miekg/dns" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/miekg/dns" ) const TypeISBN uint16 = 0x0F01 diff --git a/Godeps/_workspace/src/github.com/miekg/dns/remote_test.go b/Godeps/_workspace/src/github.com/miekg/dns/remote_test.go new file mode 100644 index 0000000000000000000000000000000000000000..4cf701fe43a660d3436250b2724ed6e12da6fd9b --- /dev/null +++ b/Godeps/_workspace/src/github.com/miekg/dns/remote_test.go @@ -0,0 +1,19 @@ +package dns + +import "testing" + +const LinodeAddr = "176.58.119.54:53" + +func TestClientRemote(t *testing.T) { + m := new(Msg) + m.SetQuestion("go.dns.miek.nl.", TypeTXT) + + c := new(Client) + r, _, err := c.Exchange(m, LinodeAddr) + if err != nil { + t.Errorf("failed to exchange: %v", err) + } + if r != nil && r.Rcode != RcodeSuccess { + t.Errorf("failed to get an valid answer\n%v", r) + } +} diff --git a/Godeps/_workspace/src/github.com/miekg/dns/sanitize.go b/Godeps/_workspace/src/github.com/miekg/dns/sanitize.go new file mode 100644 index 0000000000000000000000000000000000000000..b489f3f050bfa9b2d3a0a1bd1928660e65c56d39 --- /dev/null +++ b/Godeps/_workspace/src/github.com/miekg/dns/sanitize.go @@ -0,0 +1,84 @@ +package dns + +// Dedup removes identical RRs from rrs. It preserves the original ordering. +// The lowest TTL of any duplicates is used in the remaining one. Dedup modifies +// rrs. +// m is used to store the RRs temporay. If it is nil a new map will be allocated. +func Dedup(rrs []RR, m map[string]RR) []RR { + if m == nil { + m = make(map[string]RR) + } + // Save the keys, so we don't have to call normalizedString twice. + keys := make([]*string, 0, len(rrs)) + + for _, r := range rrs { + key := normalizedString(r) + keys = append(keys, &key) + if _, ok := m[key]; ok { + // Shortest TTL wins. + if m[key].Header().Ttl > r.Header().Ttl { + m[key].Header().Ttl = r.Header().Ttl + } + continue + } + + m[key] = r + } + // If the length of the result map equals the amount of RRs we got, + // it means they were all different. We can then just return the original rrset. + if len(m) == len(rrs) { + return rrs + } + + j := 0 + for i, r := range rrs { + // If keys[i] lives in the map, we should copy and remove it. + if _, ok := m[*keys[i]]; ok { + delete(m, *keys[i]) + rrs[j] = r + j++ + } + + if len(m) == 0 { + break + } + } + + return rrs[:j] +} + +// normalizedString returns a normalized string from r. The TTL +// is removed and the domain name is lowercased. We go from this: +// DomainName<TAB>TTL<TAB>CLASS<TAB>TYPE<TAB>RDATA to: +// lowercasename<TAB>CLASS<TAB>TYPE... +func normalizedString(r RR) string { + // A string Go DNS makes has: domainname<TAB>TTL<TAB>... + b := []byte(r.String()) + + // find the first non-escaped tab, then another, so we capture where the TTL lives. + esc := false + ttlStart, ttlEnd := 0, 0 + for i := 0; i < len(b) && ttlEnd == 0; i++ { + switch { + case b[i] == '\\': + esc = !esc + case b[i] == '\t' && !esc: + if ttlStart == 0 { + ttlStart = i + continue + } + if ttlEnd == 0 { + ttlEnd = i + } + case b[i] >= 'A' && b[i] <= 'Z' && !esc: + b[i] += 32 + default: + esc = false + } + } + + // remove TTL. + copy(b[ttlStart:], b[ttlEnd:]) + cut := ttlEnd - ttlStart + return string(b[:len(b)-cut]) +} diff --git a/Godeps/_workspace/src/github.com/miekg/dns/sanitize_test.go b/Godeps/_workspace/src/github.com/miekg/dns/sanitize_test.go new file mode 100644 index 0000000000000000000000000000000000000000..7933572791c76e29ec241419b3ab54477b0e5bf7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/miekg/dns/sanitize_test.go @@ -0,0 +1,85 @@ +package dns + +import "testing" + +func TestDedup(t *testing.T) { + // make it []string + testcases := map[[3]RR][]string{ + [...]RR{ + newRR(t, "mIek.nl. IN A 127.0.0.1"), + newRR(t, "mieK.nl. IN A 127.0.0.1"), + newRR(t, "miek.Nl. IN A 127.0.0.1"), + }: []string{"mIek.nl.\t3600\tIN\tA\t127.0.0.1"}, + [...]RR{ + newRR(t, "miEk.nl. 2000 IN A 127.0.0.1"), + newRR(t, "mieK.Nl. 1000 IN A 127.0.0.1"), + newRR(t, "Miek.nL. 500 IN A 127.0.0.1"), + }: []string{"miEk.nl.\t500\tIN\tA\t127.0.0.1"}, + [...]RR{ + newRR(t, "miek.nl. IN A 127.0.0.1"), + newRR(t, "miek.nl. CH A 127.0.0.1"), + newRR(t, "miek.nl. IN A 127.0.0.1"), + }: []string{"miek.nl.\t3600\tIN\tA\t127.0.0.1", + "miek.nl.\t3600\tCH\tA\t127.0.0.1", + }, + [...]RR{ + newRR(t, "miek.nl. CH A 127.0.0.1"), + newRR(t, "miek.nl. IN A 127.0.0.1"), + newRR(t, "miek.de. IN A 127.0.0.1"), + }: []string{"miek.nl.\t3600\tCH\tA\t127.0.0.1", + "miek.nl.\t3600\tIN\tA\t127.0.0.1", + "miek.de.\t3600\tIN\tA\t127.0.0.1", + }, + [...]RR{ + newRR(t, "miek.de. IN A 127.0.0.1"), + newRR(t, "miek.nl. 200 IN A 127.0.0.1"), + newRR(t, "miek.nl. 300 IN A 127.0.0.1"), + }: []string{"miek.de.\t3600\tIN\tA\t127.0.0.1", + "miek.nl.\t200\tIN\tA\t127.0.0.1", + }, + } + + for rr, expected := range testcases { + out := Dedup([]RR{rr[0], rr[1], rr[2]}, nil) + for i, o := range out { + if o.String() != expected[i] { + t.Fatalf("expected %v, got %v", expected[i], o.String()) + } + } + } +} + +func BenchmarkDedup(b *testing.B) { + rrs := []RR{ + newRR(nil, "miEk.nl. 2000 IN A 127.0.0.1"), + newRR(nil, "mieK.Nl. 1000 IN A 127.0.0.1"), + newRR(nil, "Miek.nL. 500 IN A 127.0.0.1"), + } + m := make(map[string]RR) + for i := 0; i < b.N; i++ { + Dedup(rrs,m ) + } +} + +func TestNormalizedString(t *testing.T) { + tests := map[RR]string{ + newRR(t, "mIEk.Nl. 3600 IN A 127.0.0.1"): "miek.nl.\tIN\tA\t127.0.0.1", + newRR(t, "m\\ iek.nL. 3600 IN A 127.0.0.1"): "m\\ iek.nl.\tIN\tA\t127.0.0.1", + newRR(t, "m\\\tIeK.nl. 3600 in A 127.0.0.1"): "m\\tiek.nl.\tIN\tA\t127.0.0.1", + } + for tc, expected := range tests { + n := normalizedString(tc) + if n != expected { + t.Logf("expected %s, got %s", expected, n) + t.Fail() + } + } +} + +func newRR(t *testing.T, s string) RR { + r, e := NewRR(s) + if e != nil { + t.Logf("newRR: %s", e) + } + return r +} diff --git a/Godeps/_workspace/src/github.com/miekg/dns/server.go b/Godeps/_workspace/src/github.com/miekg/dns/server.go index 6a74ea87dfd586e0462617f7f1a5e61cc9f3c927..48584f5ba0d2fb04dae3d83449342c206beb1894 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/server.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/server.go @@ -10,6 +10,9 @@ import ( "time" ) +// Maximum number of TCP queries before we close the socket. +const maxTCPQueries = 128 + // Handler is implemented by any value that implements ServeDNS. type Handler interface { ServeDNS(w ResponseWriter, r *Msg) @@ -159,9 +162,9 @@ func (mux *ServeMux) HandleRemove(pattern string) { if pattern == "" { panic("dns: invalid pattern " + pattern) } - // don't need a mutex here, because deleting is OK, even if the - // entry is note there. + mux.m.Lock() delete(mux.z, Fqdn(pattern)) + mux.m.Unlock() } // ServeDNS dispatches the request to the handler whose @@ -261,7 +264,7 @@ type Server struct { // Unsafe instructs the server to disregard any sanity checks and directly hand the message to // the handler. It will specfically not check if the query has the QR bit not set. Unsafe bool - // If NotifyStartedFunc is set is is called, once the server has started listening. + // If NotifyStartedFunc is set it is called once the server has started listening. NotifyStartedFunc func() // DecorateReader is optional, allows customization of the process that reads raw DNS messages. DecorateReader DecorateReader @@ -282,13 +285,13 @@ type Server struct { // ListenAndServe starts a nameserver on the configured address in *Server. func (srv *Server) ListenAndServe() error { srv.lock.Lock() + // We can't use defer() becasue serveTCP/serveUDP don't return. if srv.started { srv.lock.Unlock() return &Error{err: "server already started"} } srv.stopUDP, srv.stopTCP = make(chan bool), make(chan bool) srv.started = true - srv.lock.Unlock() addr := srv.Addr if addr == "" { addr = ":domain" @@ -300,29 +303,43 @@ func (srv *Server) ListenAndServe() error { case "tcp", "tcp4", "tcp6": a, e := net.ResolveTCPAddr(srv.Net, addr) if e != nil { + srv.lock.Unlock() + srv.started = false return e } l, e := net.ListenTCP(srv.Net, a) if e != nil { + srv.lock.Unlock() + srv.started = false return e } srv.Listener = l + srv.lock.Unlock() return srv.serveTCP(l) case "udp", "udp4", "udp6": a, e := net.ResolveUDPAddr(srv.Net, addr) if e != nil { + srv.lock.Unlock() + srv.started = false return e } l, e := net.ListenUDP(srv.Net, a) if e != nil { + srv.lock.Unlock() + srv.started = false return e } if e := setUDPSocketOptions(l); e != nil { + srv.lock.Unlock() + srv.started = false return e } srv.PacketConn = l + srv.lock.Unlock() return srv.serveUDP(l) } + srv.lock.Unlock() + srv.started = false return &Error{err: "bad network"} } @@ -336,29 +353,36 @@ func (srv *Server) ActivateAndServe() error { } srv.stopUDP, srv.stopTCP = make(chan bool), make(chan bool) srv.started = true - srv.lock.Unlock() - if srv.PacketConn != nil { + pConn := srv.PacketConn + l := srv.Listener + if pConn != nil { if srv.UDPSize == 0 { srv.UDPSize = MinMsgSize } - if t, ok := srv.PacketConn.(*net.UDPConn); ok { + if t, ok := pConn.(*net.UDPConn); ok { if e := setUDPSocketOptions(t); e != nil { + srv.lock.Unlock() + srv.started = false return e } + srv.lock.Unlock() return srv.serveUDP(t) } } - if srv.Listener != nil { - if t, ok := srv.Listener.(*net.TCPListener); ok { + if l != nil { + if t, ok := l.(*net.TCPListener); ok { + srv.lock.Unlock() return srv.serveTCP(t) } } + srv.lock.Unlock() + srv.started = false return &Error{err: "bad listeners"} } // Shutdown gracefully shuts down a server. After a call to Shutdown, ListenAndServe and // ActivateAndServe will return. All in progress queries are completed before the server -// is taken down. If the Shutdown is taking longer than the reading timeout and error +// is taken down. If the Shutdown is taking longer than the reading timeout an error // is returned. func (srv *Server) Shutdown() error { srv.lock.Lock() @@ -367,7 +391,6 @@ func (srv *Server) Shutdown() error { return &Error{err: "server not started"} } srv.started = false - srv.lock.Unlock() net, addr := srv.Net, srv.Addr switch { case srv.Listener != nil: @@ -377,6 +400,7 @@ func (srv *Server) Shutdown() error { a := srv.PacketConn.LocalAddr() net, addr = a.Network(), a.String() } + srv.lock.Unlock() fin := make(chan bool) switch net { @@ -452,7 +476,6 @@ func (srv *Server) serveTCP(l *net.TCPListener) error { srv.wgTCP.Add(1) go srv.serve(rw.RemoteAddr(), handler, m, nil, nil, rw) } - panic("dns: not reached") } // serveUDP starts a UDP listener for the server. @@ -488,7 +511,6 @@ func (srv *Server) serveUDP(l *net.UDPConn) error { srv.wgUDP.Add(1) go srv.serve(s.RemoteAddr(), handler, m, l, s, nil) } - panic("dns: not reached") } // Serve a new connection. @@ -500,7 +522,8 @@ func (srv *Server) serve(a net.Addr, h Handler, m []byte, u *net.UDPConn, s *Ses w.writer = w } - q := 0 + q := 0 // counter for the amount of TCP queries we get + defer func() { if u != nil { srv.wgUDP.Done() @@ -542,6 +565,12 @@ Redo: h.ServeDNS(w, req) // Writes back to the client Exit: + // TODO(miek): make this number configurable? + if q > maxTCPQueries { // close socket after this many queries + w.Close() + return + } + if w.hijacked { return // client calls Close() } @@ -556,11 +585,6 @@ Exit: m, e := reader.ReadTCP(w.tcp, idleTimeout) if e == nil { q++ - // TODO(miek): make this number configurable? - if q > 128 { // close socket after this many queries - w.Close() - return - } goto Redo } w.Close() diff --git a/Godeps/_workspace/src/github.com/miekg/dns/server_test.go b/Godeps/_workspace/src/github.com/miekg/dns/server_test.go index 2ff606ac3f62b649a9da0aeeef75fff4d84e3217..9e0a1832000638c6c7c73cb79a1c3438ca85b189 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/server_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/server_test.go @@ -20,7 +20,7 @@ func HelloServer(w ResponseWriter, req *Msg) { func HelloServerBadId(w ResponseWriter, req *Msg) { m := new(Msg) m.SetReply(req) - m.Id += 1 + m.Id++ m.Extra = make([]RR, 1) m.Extra[0] = &TXT{Hdr: RR_Header{Name: m.Question[0].Name, Rrtype: TypeTXT, Class: ClassINET, Ttl: 0}, Txt: []string{"Hello world"}} diff --git a/Godeps/_workspace/src/github.com/miekg/dns/sig0.go b/Godeps/_workspace/src/github.com/miekg/dns/sig0.go index 55d1a4ed492cbaa9b4e5ae0d21789482ed51f5c4..0fccddbc150ad6ce2c18854989c0a087d4bbef4a 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/sig0.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/sig0.go @@ -13,7 +13,7 @@ import ( // Sign signs a dns.Msg. It fills the signature with the appropriate data. // The SIG record should have the SignerName, KeyTag, Algorithm, Inception // and Expiration set. -func (rr *SIG) Sign(k PrivateKey, m *Msg) ([]byte, error) { +func (rr *SIG) Sign(k crypto.Signer, m *Msg) ([]byte, error) { if k == nil { return nil, ErrPrivKey } @@ -41,31 +41,26 @@ func (rr *SIG) Sign(k PrivateKey, m *Msg) ([]byte, error) { return nil, err } buf = buf[:off:cap(buf)] - var hash crypto.Hash - switch rr.Algorithm { - case DSA, RSASHA1: - hash = crypto.SHA1 - case RSASHA256, ECDSAP256SHA256: - hash = crypto.SHA256 - case ECDSAP384SHA384: - hash = crypto.SHA384 - case RSASHA512: - hash = crypto.SHA512 - default: + + hash, ok := AlgorithmToHash[rr.Algorithm] + if !ok { return nil, ErrAlg } + hasher := hash.New() // Write SIG rdata hasher.Write(buf[len(mbuf)+1+2+2+4+2:]) // Write message hasher.Write(buf[:len(mbuf)]) - hashed := hasher.Sum(nil) - sig, err := k.Sign(hashed, rr.Algorithm) + signature, err := sign(k, hasher.Sum(nil), hash, rr.Algorithm) if err != nil { return nil, err } - rr.Signature = toBase64(sig) + + rr.Signature = toBase64(signature) + sig := string(signature) + buf = append(buf, sig...) if len(buf) > int(^uint16(0)) { return nil, ErrBuf diff --git a/Godeps/_workspace/src/github.com/miekg/dns/sig0_test.go b/Godeps/_workspace/src/github.com/miekg/dns/sig0_test.go index cdd57ab8195e9b9dde4a8642b92711158c1337ab..c13adf399604ec4f09f414b8dad09eba577fa9bc 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/sig0_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/sig0_test.go @@ -1,6 +1,7 @@ package dns import ( + "crypto" "testing" "time" ) @@ -11,7 +12,7 @@ func TestSIG0(t *testing.T) { } m := new(Msg) m.SetQuestion("example.org.", TypeSOA) - for _, alg := range []uint8{DSA, ECDSAP256SHA256, ECDSAP384SHA384, RSASHA1, RSASHA256, RSASHA512} { + for _, alg := range []uint8{ECDSAP256SHA256, ECDSAP384SHA384, RSASHA1, RSASHA256, RSASHA512} { algstr := AlgorithmToString[alg] keyrr := new(KEY) keyrr.Hdr.Name = algstr + "." @@ -40,7 +41,7 @@ func TestSIG0(t *testing.T) { sigrr.Inception = now - 300 sigrr.KeyTag = keyrr.KeyTag() sigrr.SignerName = keyrr.Hdr.Name - mb, err := sigrr.Sign(pk, m) + mb, err := sigrr.Sign(pk.(crypto.Signer), m) if err != nil { t.Errorf("Failed to sign message using “%s”: %v", algstr, err) continue @@ -79,7 +80,7 @@ func TestSIG0(t *testing.T) { } sigrr.Expiration = 2 sigrr.Inception = 1 - mb, _ = sigrr.Sign(pk, m) + mb, _ = sigrr.Sign(pk.(crypto.Signer), m) if err := sigrr.Verify(keyrr, mb); err == nil { t.Errorf("Verify succeeded on an expired message using “%s”", algstr) continue diff --git a/Godeps/_workspace/src/github.com/miekg/dns/types.go b/Godeps/_workspace/src/github.com/miekg/dns/types.go index 39498c0d525d09e537e7dc3bc164696a732be8c7..55a50b811df9325b5fe5fc284051585119912ba7 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/types.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/types.go @@ -46,7 +46,6 @@ const ( TypeX25 uint16 = 19 TypeISDN uint16 = 20 TypeRT uint16 = 21 - TypeNSAP uint16 = 22 TypeNSAPPTR uint16 = 23 TypeSIG uint16 = 24 TypeKEY uint16 = 25 @@ -92,26 +91,24 @@ const ( TypeLP uint16 = 107 TypeEUI48 uint16 = 108 TypeEUI64 uint16 = 109 + TypeURI uint16 = 256 + TypeCAA uint16 = 257 TypeTKEY uint16 = 249 TypeTSIG uint16 = 250 // valid Question.Qtype only - TypeIXFR uint16 = 251 TypeAXFR uint16 = 252 TypeMAILB uint16 = 253 TypeMAILA uint16 = 254 TypeANY uint16 = 255 - TypeURI uint16 = 256 - TypeCAA uint16 = 257 TypeTA uint16 = 32768 TypeDLV uint16 = 32769 TypeReserved uint16 = 65535 // valid Question.Qclass - ClassINET = 1 ClassCSNET = 2 ClassCHAOS = 3 @@ -119,8 +116,7 @@ const ( ClassNONE = 254 ClassANY = 255 - // Msg.rcode - + // Message Response Codes. RcodeSuccess = 0 RcodeFormatError = 1 RcodeServerFailure = 2 @@ -141,8 +137,7 @@ const ( RcodeBadAlg = 21 RcodeBadTrunc = 22 // TSIG - // Opcode, there is no 3 - + // Message Opcodes. There is no 3. OpcodeQuery = 0 OpcodeIQuery = 1 OpcodeStatus = 2 @@ -150,7 +145,7 @@ const ( OpcodeUpdate = 5 ) -// The wire format for the DNS packet header. +// Headers is the wire format for the DNS packet header. type Header struct { Id uint16 Bits uint16 @@ -179,7 +174,7 @@ const ( LOC_ALTITUDEBASE = 100000 ) -// RFC 4398, Section 2.1 +// Different Certificate Types, see RFC 4398, Section 2.1 const ( CertPKIX = 1 + iota CertSPKI @@ -193,6 +188,8 @@ const ( CertOID = 254 ) +// CertTypeToString converts the Cert Type to its string representation. +// See RFC 4398 and RFC 6944. var CertTypeToString = map[uint16]string{ CertPKIX: "PKIX", CertSPKI: "SPKI", @@ -206,6 +203,7 @@ var CertTypeToString = map[uint16]string{ CertOID: "OID", } +// StringToCertType is the reverseof CertTypeToString. var StringToCertType = reverseInt16(CertTypeToString) // Question holds a DNS question. There can be multiple questions in the @@ -229,6 +227,8 @@ func (q *Question) len() int { return l + 4 } +// ANY is a wildcard record. See RFC 1035, Section 3.2.3. ANY +// is named "*" there. type ANY struct { Hdr RR_Header // Does not have any rdata @@ -702,7 +702,7 @@ func (rr *NAPTR) len() int { len(rr.Regexp) + 1 + len(rr.Replacement) + 1 } -// See RFC 4398. +// The CERT resource record, see RFC 4398. type CERT struct { Hdr RR_Header Type uint16 @@ -738,7 +738,7 @@ func (rr *CERT) len() int { base64.StdEncoding.DecodedLen(len(rr.Certificate)) } -// See RFC 2672. +// The DNAME resource record, see RFC 2672. type DNAME struct { Hdr RR_Header Target string `dns:"domain-name"` @@ -850,7 +850,6 @@ func cmToM(m, e uint8) string { return s } -// String returns a string version of a LOC func (rr *LOC) String() string { s := rr.Hdr.String() @@ -1180,16 +1179,6 @@ func (rr *RKEY) String() string { " " + rr.PublicKey } -type NSAP struct { - Hdr RR_Header - Nsap string -} - -func (rr *NSAP) Header() *RR_Header { return &rr.Hdr } -func (rr *NSAP) copy() RR { return &NSAP{*rr.Hdr.copyHeader(), rr.Nsap} } -func (rr *NSAP) String() string { return rr.Hdr.String() + "0x" + rr.Nsap } -func (rr *NSAP) len() int { return rr.Hdr.len() + 1 + len(rr.Nsap) + 1 } - type NSAPPTR struct { Hdr RR_Header Ptr string `dns:"domain-name"` @@ -1721,7 +1710,6 @@ var typeToRR = map[uint16]func() RR{ TypeNINFO: func() RR { return new(NINFO) }, TypeNIMLOC: func() RR { return new(NIMLOC) }, TypeNS: func() RR { return new(NS) }, - TypeNSAP: func() RR { return new(NSAP) }, TypeNSAPPTR: func() RR { return new(NSAPPTR) }, TypeNSEC3: func() RR { return new(NSEC3) }, TypeNSEC3PARAM: func() RR { return new(NSEC3PARAM) }, diff --git a/Godeps/_workspace/src/github.com/miekg/dns/udp.go b/Godeps/_workspace/src/github.com/miekg/dns/udp.go index 5430e84ecba48209c1b29ce9d94be86583df3230..fc86563744e27433bc40f454d8d79e4bf6eae840 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/udp.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/udp.go @@ -7,11 +7,14 @@ import ( "syscall" ) +// SessionUDP holds the remote address and the associated +// out-of-band data. type SessionUDP struct { raddr *net.UDPAddr context []byte } +// RemoteAddr returns the remote network address. func (s *SessionUDP) RemoteAddr() net.Addr { return s.raddr } // setUDPSocketOptions sets the UDP socket options. diff --git a/Godeps/_workspace/src/github.com/miekg/dns/xfr.go b/Godeps/_workspace/src/github.com/miekg/dns/xfr.go index c098925d2545baa7b928b86acf491b95be525a2d..7d3a67b8e4516f9b71b8d277b6ff3e07a0bff48c 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/xfr.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/xfr.go @@ -23,14 +23,26 @@ type Transfer struct { // Think we need to away to stop the transfer // In performs an incoming transfer with the server in a. +// If you would like to set the source IP, or some other attribute +// of a Dialer for a Transfer, you can do so by specifying the attributes +// in the Transfer.Conn: +// +// d := net.Dialer{LocalAddr: transfer_source} +// con, err := d.Dial("tcp", master) +// dnscon := &dns.Conn{Conn:con} +// transfer = &dns.Transfer{Conn: dnscon} +// channel, err := transfer.In(message, master) +// func (t *Transfer) In(q *Msg, a string) (env chan *Envelope, err error) { timeout := dnsTimeout if t.DialTimeout != 0 { timeout = t.DialTimeout } - t.Conn, err = DialTimeout("tcp", a, timeout) - if err != nil { - return nil, err + if t.Conn == nil { + t.Conn, err = DialTimeout("tcp", a, timeout) + if err != nil { + return nil, err + } } if err := t.WriteMsg(q); err != nil { return nil, err @@ -91,7 +103,6 @@ func (t *Transfer) inAxfr(id uint16, c chan *Envelope) { c <- &Envelope{in.Answer, nil} } } - panic("dns: not reached") } func (t *Transfer) inIxfr(id uint16, c chan *Envelope) { diff --git a/Godeps/_workspace/src/github.com/miekg/dns/xfr_test.go b/Godeps/_workspace/src/github.com/miekg/dns/xfr_test.go index d52d84c6a3febd5f54c5eb60a4a74ba095c87403..4917cfecab67da8cb180993d597153247b5f2e25 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/xfr_test.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/xfr_test.go @@ -1,3 +1,5 @@ +// +build net + package dns import ( @@ -16,7 +18,8 @@ func getIP(s string) string { // flaky, need to setup local server and test from // that. -func testClientAXFR(t *testing.T) { +func TestAXFR_Miek(t *testing.T) { + // This test runs against a server maintained by Miek if testing.Short() { return } @@ -43,7 +46,8 @@ func testClientAXFR(t *testing.T) { } // fails. -func testClientAXFRMultipleEnvelopes(t *testing.T) { +func TestAXFR_NLNL_MultipleEnvelopes(t *testing.T) { + // This test runs against a server maintained by NLnet Labs if testing.Short() { return } @@ -65,7 +69,8 @@ func testClientAXFRMultipleEnvelopes(t *testing.T) { } } -func testClientTsigAXFR(t *testing.T) { +func TestAXFR_Miek_Tsig(t *testing.T) { + // This test runs against a server maintained by Miek if testing.Short() { return } @@ -90,3 +95,67 @@ func testClientTsigAXFR(t *testing.T) { } } } + +func TestAXFR_SIDN_NSD3_NONE(t *testing.T) { testAXFRSIDN(t, "nsd", "") } +func TestAXFR_SIDN_NSD3_MD5(t *testing.T) { testAXFRSIDN(t, "nsd", HmacMD5) } +func TestAXFR_SIDN_NSD3_SHA1(t *testing.T) { testAXFRSIDN(t, "nsd", HmacSHA1) } +func TestAXFR_SIDN_NSD3_SHA256(t *testing.T) { testAXFRSIDN(t, "nsd", HmacSHA256) } + +func TestAXFR_SIDN_NSD4_NONE(t *testing.T) { testAXFRSIDN(t, "nsd4", "") } +func TestAXFR_SIDN_NSD4_MD5(t *testing.T) { testAXFRSIDN(t, "nsd4", HmacMD5) } +func TestAXFR_SIDN_NSD4_SHA1(t *testing.T) { testAXFRSIDN(t, "nsd4", HmacSHA1) } +func TestAXFR_SIDN_NSD4_SHA256(t *testing.T) { testAXFRSIDN(t, "nsd4", HmacSHA256) } + +func TestAXFR_SIDN_BIND9_NONE(t *testing.T) { testAXFRSIDN(t, "bind9", "") } +func TestAXFR_SIDN_BIND9_MD5(t *testing.T) { testAXFRSIDN(t, "bind9", HmacMD5) } +func TestAXFR_SIDN_BIND9_SHA1(t *testing.T) { testAXFRSIDN(t, "bind9", HmacSHA1) } +func TestAXFR_SIDN_BIND9_SHA256(t *testing.T) { testAXFRSIDN(t, "bind9", HmacSHA256) } + +func TestAXFR_SIDN_KNOT_NONE(t *testing.T) { testAXFRSIDN(t, "knot", "") } +func TestAXFR_SIDN_KNOT_MD5(t *testing.T) { testAXFRSIDN(t, "knot", HmacMD5) } +func TestAXFR_SIDN_KNOT_SHA1(t *testing.T) { testAXFRSIDN(t, "knot", HmacSHA1) } +func TestAXFR_SIDN_KNOT_SHA256(t *testing.T) { testAXFRSIDN(t, "knot", HmacSHA256) } + +func TestAXFR_SIDN_POWERDNS_NONE(t *testing.T) { testAXFRSIDN(t, "powerdns", "") } +func TestAXFR_SIDN_POWERDNS_MD5(t *testing.T) { testAXFRSIDN(t, "powerdns", HmacMD5) } +func TestAXFR_SIDN_POWERDNS_SHA1(t *testing.T) { testAXFRSIDN(t, "powerdns", HmacSHA1) } +func TestAXFR_SIDN_POWERDNS_SHA256(t *testing.T) { testAXFRSIDN(t, "powerdns", HmacSHA256) } + +func TestAXFR_SIDN_YADIFA_NONE(t *testing.T) { testAXFRSIDN(t, "yadifa", "") } +func TestAXFR_SIDN_YADIFA_MD5(t *testing.T) { testAXFRSIDN(t, "yadifa", HmacMD5) } +func TestAXFR_SIDN_YADIFA_SHA1(t *testing.T) { testAXFRSIDN(t, "yadifa", HmacSHA1) } +func TestAXFR_SIDN_YADIFA_SHA256(t *testing.T) { testAXFRSIDN(t, "yadifa", HmacSHA256) } + +func testAXFRSIDN(t *testing.T, host, alg string) { + // This tests run against a server maintained by SIDN labs, see: + // https://workbench.sidnlabs.nl/ + if testing.Short() { + return + } + x := new(Transfer) + x.TsigSecret = map[string]string{ + "wb_md5.": "Wu/utSasZUkoeCNku152Zw==", + "wb_sha1_longkey.": "uhMpEhPq/RAD9Bt4mqhfmi+7ZdKmjLQb/lcrqYPXR4s/nnbsqw==", + "wb_sha256.": "npfrIJjt/MJOjGJoBNZtsjftKMhkSpIYMv2RzRZt1f8=", + } + keyname := map[string]string{ + HmacMD5: "wb_md5.", + HmacSHA1: "wb_sha1_longkey.", + HmacSHA256: "wb_sha256.", + }[alg] + + m := new(Msg) + m.SetAxfr("types.wb.sidnlabs.nl.") + if keyname != "" { + m.SetTsig(keyname, alg, 300, time.Now().Unix()) + } + c, err := x.In(m, host+".sidnlabs.nl:53") + if err != nil { + t.Fatal(err) + } + for e := range c { + if e.Error != nil { + t.Fatal(e.Error) + } + } +} diff --git a/Godeps/_workspace/src/github.com/miekg/dns/zgenerate.go b/Godeps/_workspace/src/github.com/miekg/dns/zgenerate.go index ae92531572c8eb83644f0d82d3eaa7f85e9833c1..c506e962666b0dfdc3606523cf22fa96b3a82632 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/zgenerate.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/zgenerate.go @@ -141,11 +141,11 @@ func modToPrintf(s string) (string, int, string) { return "", 0, "bad base in $GENERATE" } offset, err := strconv.Atoi(xs[0]) - if err != nil { + if err != nil || offset > 255 { return "", 0, "bad offset in $GENERATE" } width, err := strconv.Atoi(xs[1]) - if err != nil { + if err != nil || width > 255 { return "", offset, "bad width in $GENERATE" } switch { diff --git a/Godeps/_workspace/src/github.com/miekg/dns/zscan.go b/Godeps/_workspace/src/github.com/miekg/dns/zscan.go index 06be9cc6d17d0b705438c40e72615360b976acc6..40ba35c36dac980d081275f394992213f0bb9145 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/zscan.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/zscan.go @@ -131,11 +131,11 @@ func ReadRR(q io.Reader, filename string) (RR, error) { return r.RR, nil } -// ParseZone reads a RFC 1035 style one from r. It returns *Tokens on the +// ParseZone reads a RFC 1035 style zonefile from r. It returns *Tokens on the // returned channel, which consist out the parsed RR, a potential comment or an error. // If there is an error the RR is nil. The string file is only used // in error reporting. The string origin is used as the initial origin, as -// if the file would start with: $ORIGIN origin . +// if the file would start with: $ORIGIN origin . // The directives $INCLUDE, $ORIGIN, $TTL and $GENERATE are supported. // The channel t is closed by ParseZone when the end of r is reached. // @@ -152,7 +152,7 @@ func ReadRR(q io.Reader, filename string) (RR, error) { // // foo. IN A 10.0.0.1 ; this is a comment // -// The text "; this is comment" is returned in Token.Comment . Comments inside the +// The text "; this is comment" is returned in Token.Comment. Comments inside the // RR are discarded. Comments on a line by themselves are discarded too. func ParseZone(r io.Reader, origin, file string) chan *Token { return parseZoneHelper(r, origin, file, 10000) @@ -281,7 +281,7 @@ func parseZone(r io.Reader, origin, f string, t chan *Token, include int) { case zBlank: l := <-c if l.value == zString { - if _, ok := IsDomainName(l.token); !ok { + if _, ok := IsDomainName(l.token); !ok || l.length == 0 || l.err { t <- &Token{Error: &ParseError{f, "bad origin name", l}} return } @@ -806,7 +806,11 @@ func zlexer(s *scan, c chan lex) { // Extract the class number from CLASSxx func classToInt(token string) (uint16, bool) { - class, ok := strconv.Atoi(token[5:]) + offset := 5 + if len(token) < offset+1 { + return 0, false + } + class, ok := strconv.Atoi(token[offset:]) if ok != nil || class > maxUint16 { return 0, false } @@ -815,7 +819,11 @@ func classToInt(token string) (uint16, bool) { // Extract the rr number from TYPExxx func typeToInt(token string) (uint16, bool) { - typ, ok := strconv.Atoi(token[4:]) + offset := 4 + if len(token) < offset+1 { + return 0, false + } + typ, ok := strconv.Atoi(token[offset:]) if ok != nil || typ > maxUint16 { return 0, false } diff --git a/Godeps/_workspace/src/github.com/miekg/dns/zscan_rr.go b/Godeps/_workspace/src/github.com/miekg/dns/zscan_rr.go index 03e78db541392d7c9cad40eee5c35ab36c3d5c6d..a2db008fa98b274de13f04c991819dc78b2d74e8 100644 --- a/Godeps/_workspace/src/github.com/miekg/dns/zscan_rr.go +++ b/Godeps/_workspace/src/github.com/miekg/dns/zscan_rr.go @@ -145,7 +145,7 @@ func setA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } rr.A = net.ParseIP(l.token) - if rr.A == nil { + if rr.A == nil || l.err { return nil, &ParseError{f, "bad A A", l}, "" } return rr, nil, "" @@ -160,7 +160,7 @@ func setAAAA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } rr.AAAA = net.ParseIP(l.token) - if rr.AAAA == nil { + if rr.AAAA == nil || l.err { return nil, &ParseError{f, "bad AAAA AAAA", l}, "" } return rr, nil, "" @@ -180,7 +180,7 @@ func setNS(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad NS Ns", l}, "" } if rr.Ns[l.length-1] != '.' { @@ -203,7 +203,7 @@ func setPTR(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad PTR Ptr", l}, "" } if rr.Ptr[l.length-1] != '.' { @@ -226,7 +226,7 @@ func setNSAPPTR(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad NSAP-PTR Ptr", l}, "" } if rr.Ptr[l.length-1] != '.' { @@ -248,7 +248,7 @@ func setRP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.Mbox = o } else { _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad RP Mbox", l}, "" } if rr.Mbox[l.length-1] != '.' { @@ -263,7 +263,7 @@ func setRP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad RP Txt", l}, "" } if rr.Txt[l.length-1] != '.' { @@ -286,7 +286,7 @@ func setMR(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MR Mr", l}, "" } if rr.Mr[l.length-1] != '.' { @@ -309,7 +309,7 @@ func setMB(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MB Mb", l}, "" } if rr.Mb[l.length-1] != '.' { @@ -332,7 +332,7 @@ func setMG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MG Mg", l}, "" } if rr.Mg[l.length-1] != '.' { @@ -380,7 +380,7 @@ func setMINFO(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.Rmail = o } else { _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MINFO Rmail", l}, "" } if rr.Rmail[l.length-1] != '.' { @@ -395,7 +395,7 @@ func setMINFO(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MINFO Email", l}, "" } if rr.Email[l.length-1] != '.' { @@ -418,7 +418,7 @@ func setMF(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MF Mf", l}, "" } if rr.Mf[l.length-1] != '.' { @@ -441,7 +441,7 @@ func setMD(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MD Md", l}, "" } if rr.Md[l.length-1] != '.' { @@ -459,7 +459,7 @@ func setMX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad MX Pref", l}, "" } rr.Preference = uint16(i) @@ -471,7 +471,7 @@ func setMX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad MX Mx", l}, "" } if rr.Mx[l.length-1] != '.' { @@ -500,7 +500,7 @@ func setRT(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad RT Host", l}, "" } if rr.Host[l.length-1] != '.' { @@ -518,7 +518,7 @@ func setAFSDB(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad AFSDB Subtype", l}, "" } rr.Subtype = uint16(i) @@ -530,7 +530,7 @@ func setAFSDB(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad AFSDB Hostname", l}, "" } if rr.Hostname[l.length-1] != '.' { @@ -544,6 +544,12 @@ func setX25(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.Hdr = h l := <-c + if l.length == 0 { + return rr, nil, "" + } + if l.err { + return nil, &ParseError{f, "bad X25 PSDNAddress", l}, "" + } rr.PSDNAddress = l.token return rr, nil, "" } @@ -557,7 +563,7 @@ func setKX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad KX Pref", l}, "" } rr.Preference = uint16(i) @@ -569,7 +575,7 @@ func setKX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad KX Exchanger", l}, "" } if rr.Exchanger[l.length-1] != '.' { @@ -592,7 +598,7 @@ func setCNAME(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad CNAME Target", l}, "" } if rr.Target[l.length-1] != '.' { @@ -615,7 +621,7 @@ func setDNAME(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad CNAME Target", l}, "" } if rr.Target[l.length-1] != '.' { @@ -638,7 +644,7 @@ func setSOA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.Ns = o } else { _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad SOA Ns", l}, "" } if rr.Ns[l.length-1] != '.' { @@ -652,7 +658,7 @@ func setSOA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.Mbox = o } else { _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad SOA Mbox", l}, "" } if rr.Mbox[l.length-1] != '.' { @@ -667,6 +673,9 @@ func setSOA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { ) for i := 0; i < 5; i++ { l = <-c + if l.err { + return nil, &ParseError{f, "bad SOA zone parameter", l}, "" + } if j, e := strconv.Atoi(l.token); e != nil { if i == 0 { // Serial should be a number @@ -708,21 +717,21 @@ func setSRV(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad SRV Priority", l}, "" } rr.Priority = uint16(i) <-c // zBlank l = <-c // zString i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad SRV Weight", l}, "" } rr.Weight = uint16(i) <-c // zBlank l = <-c // zString i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad SRV Port", l}, "" } rr.Port = uint16(i) @@ -734,7 +743,7 @@ func setSRV(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad SRV Target", l}, "" } if rr.Target[l.length-1] != '.' { @@ -752,14 +761,14 @@ func setNAPTR(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NAPTR Order", l}, "" } rr.Order = uint16(i) <-c // zBlank l = <-c // zString i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NAPTR Preference", l}, "" } rr.Preference = uint16(i) @@ -828,7 +837,7 @@ func setNAPTR(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad NAPTR Replacement", l}, "" } if rr.Replacement[l.length-1] != '.' { @@ -850,7 +859,7 @@ func setTALINK(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.PreviousName = o } else { _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad TALINK PreviousName", l}, "" } if rr.PreviousName[l.length-1] != '.' { @@ -865,7 +874,7 @@ func setTALINK(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad TALINK NextName", l}, "" } if rr.NextName[l.length-1] != '.' { @@ -887,25 +896,27 @@ func setLOC(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { if l.length == 0 { return rr, nil, "" } - if i, e := strconv.Atoi(l.token); e != nil { + i, e := strconv.Atoi(l.token) + if e != nil || l.err { return nil, &ParseError{f, "bad LOC Latitude", l}, "" - } else { - rr.Latitude = 1000 * 60 * 60 * uint32(i) } + rr.Latitude = 1000 * 60 * 60 * uint32(i) + <-c // zBlank // Either number, 'N' or 'S' l = <-c if rr.Latitude, ok = locCheckNorth(l.token, rr.Latitude); ok { goto East } - if i, e := strconv.Atoi(l.token); e != nil { + i, e = strconv.Atoi(l.token) + if e != nil || l.err { return nil, &ParseError{f, "bad LOC Latitude minutes", l}, "" - } else { - rr.Latitude += 1000 * 60 * uint32(i) } + rr.Latitude += 1000 * 60 * uint32(i) + <-c // zBlank l = <-c - if i, e := strconv.ParseFloat(l.token, 32); e != nil { + if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err { return nil, &ParseError{f, "bad LOC Latitude seconds", l}, "" } else { rr.Latitude += uint32(1000 * i) @@ -923,7 +934,7 @@ East: // East <-c // zBlank l = <-c - if i, e := strconv.Atoi(l.token); e != nil { + if i, e := strconv.Atoi(l.token); e != nil || l.err { return nil, &ParseError{f, "bad LOC Longitude", l}, "" } else { rr.Longitude = 1000 * 60 * 60 * uint32(i) @@ -934,14 +945,14 @@ East: if rr.Longitude, ok = locCheckEast(l.token, rr.Longitude); ok { goto Altitude } - if i, e := strconv.Atoi(l.token); e != nil { + if i, e := strconv.Atoi(l.token); e != nil || l.err { return nil, &ParseError{f, "bad LOC Longitude minutes", l}, "" } else { rr.Longitude += 1000 * 60 * uint32(i) } <-c // zBlank l = <-c - if i, e := strconv.ParseFloat(l.token, 32); e != nil { + if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err { return nil, &ParseError{f, "bad LOC Longitude seconds", l}, "" } else { rr.Longitude += uint32(1000 * i) @@ -958,6 +969,9 @@ East: Altitude: <-c // zBlank l = <-c + if l.length == 0 || l.err { + return nil, &ParseError{f, "bad LOC Altitude", l}, "" + } if l.token[len(l.token)-1] == 'M' || l.token[len(l.token)-1] == 'm' { l.token = l.token[0 : len(l.token)-1] } @@ -1014,17 +1028,23 @@ func setHIP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, l.comment } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad HIP PublicKeyAlgorithm", l}, "" } rr.PublicKeyAlgorithm = uint8(i) - <-c // zBlank - l = <-c // zString + <-c // zBlank + l = <-c // zString + if l.length == 0 || l.err { + return nil, &ParseError{f, "bad HIP Hit", l}, "" + } rr.Hit = l.token // This can not contain spaces, see RFC 5205 Section 6. rr.HitLength = uint8(len(rr.Hit)) / 2 - <-c // zBlank - l = <-c // zString + <-c // zBlank + l = <-c // zString + if l.length == 0 || l.err { + return nil, &ParseError{f, "bad HIP PublicKey", l}, "" + } rr.PublicKey = l.token // This cannot contain spaces rr.PublicKeyLength = uint16(base64.StdEncoding.DecodedLen(len(rr.PublicKey))) @@ -1036,10 +1056,11 @@ func setHIP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { case zString: if l.token == "@" { xs = append(xs, o) + l = <-c continue } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad HIP RendezvousServers", l}, "" } if l.token[l.length-1] != '.' { @@ -1075,7 +1096,7 @@ func setCERT(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { <-c // zBlank l = <-c // zString i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad CERT KeyTag", l}, "" } rr.KeyTag = uint16(i) @@ -1139,21 +1160,21 @@ func setRRSIG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { <-c // zBlank l = <-c i, err := strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad RRSIG Algorithm", l}, "" } rr.Algorithm = uint8(i) <-c // zBlank l = <-c i, err = strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad RRSIG Labels", l}, "" } rr.Labels = uint8(i) <-c // zBlank l = <-c i, err = strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad RRSIG OrigTtl", l}, "" } rr.OrigTtl = uint32(i) @@ -1184,7 +1205,7 @@ func setRRSIG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { <-c // zBlank l = <-c i, err = strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad RRSIG KeyTag", l}, "" } rr.KeyTag = uint16(i) @@ -1195,7 +1216,7 @@ func setRRSIG(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.SignerName = o } else { _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad RRSIG SignerName", l}, "" } if rr.SignerName[l.length-1] != '.' { @@ -1223,7 +1244,7 @@ func setNSEC(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr.NextDomain = o } else { _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad NSEC NextDomain", l}, "" } if rr.NextDomain[l.length-1] != '.' { @@ -1265,27 +1286,27 @@ func setNSEC3(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, l.comment } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NSEC3 Hash", l}, "" } rr.Hash = uint8(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NSEC3 Flags", l}, "" } rr.Flags = uint8(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NSEC3 Iterations", l}, "" } rr.Iterations = uint16(i) <-c l = <-c - if len(l.token) == 0 { + if len(l.token) == 0 || l.err { return nil, &ParseError{f, "bad NSEC3 Salt", l}, "" } rr.SaltLength = uint8(len(l.token)) / 2 @@ -1293,6 +1314,9 @@ func setNSEC3(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { <-c l = <-c + if len(l.token) == 0 || l.err { + return nil, &ParseError{f, "bad NSEC3 NextDomain", l}, "" + } rr.HashLength = 20 // Fix for NSEC3 (sha1 160 bits) rr.NextDomain = l.token @@ -1330,21 +1354,21 @@ func setNSEC3PARAM(h RR_Header, c chan lex, o, f string) (RR, *ParseError, strin return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NSEC3PARAM Hash", l}, "" } rr.Hash = uint8(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NSEC3PARAM Flags", l}, "" } rr.Flags = uint8(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NSEC3PARAM Iterations", l}, "" } rr.Iterations = uint16(i) @@ -1363,7 +1387,7 @@ func setEUI48(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { if l.length == 0 { return rr, nil, "" } - if l.length != 17 { + if l.length != 17 || l.err { return nil, &ParseError{f, "bad EUI48 Address", l}, "" } addr := make([]byte, 12) @@ -1395,7 +1419,7 @@ func setEUI64(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { if l.length == 0 { return rr, nil, "" } - if l.length != 23 { + if l.length != 23 || l.err { return nil, &ParseError{f, "bad EUI64 Address", l}, "" } addr := make([]byte, 16) @@ -1428,7 +1452,7 @@ func setWKS(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, l.comment } rr.Address = net.ParseIP(l.token) - if rr.Address == nil { + if rr.Address == nil || l.err { return nil, &ParseError{f, "bad WKS Address", l}, "" } @@ -1436,7 +1460,7 @@ func setWKS(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { l = <-c proto := "tcp" i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad WKS Protocol", l}, "" } rr.Protocol = uint8(i) @@ -1462,11 +1486,11 @@ func setWKS(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { // Ok case zString: if k, err = net.LookupPort(proto, l.token); err != nil { - if i, e := strconv.Atoi(l.token); e != nil { // If a number use that + i, e := strconv.Atoi(l.token) // If a number use that + if e != nil { return nil, &ParseError{f, "bad WKS BitMap", l}, "" - } else { - rr.BitMap = append(rr.BitMap, uint16(i)) } + rr.BitMap = append(rr.BitMap, uint16(i)) } rr.BitMap = append(rr.BitMap, uint16(k)) default: @@ -1486,14 +1510,14 @@ func setSSHFP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad SSHFP Algorithm", l}, "" } rr.Algorithm = uint8(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad SSHFP Type", l}, "" } rr.Type = uint8(i) @@ -1515,21 +1539,21 @@ func setDNSKEYs(h RR_Header, c chan lex, o, f, typ string) (RR, *ParseError, str return rr, nil, l.comment } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad " + typ + " Flags", l}, "" } rr.Flags = uint16(i) <-c // zBlank l = <-c // zString i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad " + typ + " Protocol", l}, "" } rr.Protocol = uint8(i) <-c // zBlank l = <-c // zString i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad " + typ + " Algorithm", l}, "" } rr.Algorithm = uint8(i) @@ -1571,21 +1595,21 @@ func setRKEY(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, l.comment } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad RKEY Flags", l}, "" } rr.Flags = uint16(i) <-c // zBlank l = <-c // zString i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad RKEY Protocol", l}, "" } rr.Protocol = uint8(i) <-c // zBlank l = <-c // zString i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad RKEY Algorithm", l}, "" } rr.Algorithm = uint8(i) @@ -1619,34 +1643,6 @@ func setNIMLOC(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, c1 } -func setNSAP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { - rr := new(NSAP) - rr.Hdr = h - chunks, e1, c1 := endingToTxtSlice(c, "bad NSAP Nsap", f) - if e1 != nil { - return nil, e1, c1 - } - // data would come as one string or multiple... Just to ignore possible - // variety let's merge things back together and split to actual "words" - s := strings.Fields(strings.Join(chunks, " ")) - if len(s) == 0 { - return rr, nil, c1 - } - if len(s[0]) >= 2 && s[0][0:2] == "0x" || s[0][0:2] == "0X" { - // although RFC only suggests 0x there is no clarification that X is not allowed - rr.Nsap = strings.Join(s, "")[2:] - } else { - // since we do not know what to do with this data, and, we would not use original length - // in formatting, it's moot to check correctness of the length - _, err := strconv.Atoi(s[0]) - if err != nil { - return nil, &ParseError{f, "bad NSAP Length", lex{token: s[0]}}, "" - } - rr.Nsap = strings.Join(s[1:], "") - } - return rr, nil, c1 -} - func setGPOS(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { rr := new(GPOS) rr.Hdr = h @@ -1655,21 +1651,21 @@ func setGPOS(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, e := strconv.ParseFloat(l.token, 64) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad GPOS Longitude", l}, "" } rr.Longitude = l.token <-c // zBlank l = <-c _, e = strconv.ParseFloat(l.token, 64) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad GPOS Latitude", l}, "" } rr.Latitude = l.token <-c // zBlank l = <-c _, e = strconv.ParseFloat(l.token, 64) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad GPOS Altitude", l}, "" } rr.Altitude = l.token @@ -1684,7 +1680,7 @@ func setDSs(h RR_Header, c chan lex, o, f, typ string) (RR, *ParseError, string) return rr, nil, l.comment } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad " + typ + " KeyTag", l}, "" } rr.KeyTag = uint16(i) @@ -1692,7 +1688,7 @@ func setDSs(h RR_Header, c chan lex, o, f, typ string) (RR, *ParseError, string) l = <-c if i, e := strconv.Atoi(l.token); e != nil { i, ok := StringToAlgorithm[l.tokenUpper] - if !ok { + if !ok || l.err { return nil, &ParseError{f, "bad " + typ + " Algorithm", l}, "" } rr.Algorithm = i @@ -1702,7 +1698,7 @@ func setDSs(h RR_Header, c chan lex, o, f, typ string) (RR, *ParseError, string) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad " + typ + " DigestType", l}, "" } rr.DigestType = uint8(i) @@ -1743,7 +1739,7 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, l.comment } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad TA KeyTag", l}, "" } rr.KeyTag = uint16(i) @@ -1751,7 +1747,7 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { l = <-c if i, e := strconv.Atoi(l.token); e != nil { i, ok := StringToAlgorithm[l.tokenUpper] - if !ok { + if !ok || l.err { return nil, &ParseError{f, "bad TA Algorithm", l}, "" } rr.Algorithm = i @@ -1761,7 +1757,7 @@ func setTA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad TA DigestType", l}, "" } rr.DigestType = uint8(i) @@ -1781,21 +1777,21 @@ func setTLSA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, l.comment } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad TLSA Usage", l}, "" } rr.Usage = uint8(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad TLSA Selector", l}, "" } rr.Selector = uint8(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad TLSA MatchingType", l}, "" } rr.MatchingType = uint8(i) @@ -1818,7 +1814,7 @@ func setRFC3597(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) <-c // zBlank l = <-c rdlength, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad RFC3597 Rdata ", l}, "" } @@ -1881,14 +1877,14 @@ func setURI(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad URI Priority", l}, "" } rr.Priority = uint16(i) <-c // zBlank l = <-c i, e = strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad URI Weight", l}, "" } rr.Weight = uint16(i) @@ -1927,14 +1923,14 @@ func setNID(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad NID Preference", l}, "" } rr.Preference = uint16(i) <-c // zBlank l = <-c // zString u, err := stringToNodeID(l) - if err != nil { + if err != nil || l.err { return nil, err, "" } rr.NodeID = u @@ -1950,14 +1946,14 @@ func setL32(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad L32 Preference", l}, "" } rr.Preference = uint16(i) <-c // zBlank l = <-c // zString rr.Locator32 = net.ParseIP(l.token) - if rr.Locator32 == nil { + if rr.Locator32 == nil || l.err { return nil, &ParseError{f, "bad L32 Locator", l}, "" } return rr, nil, "" @@ -1972,7 +1968,7 @@ func setLP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad LP Preference", l}, "" } rr.Preference = uint16(i) @@ -1987,7 +1983,7 @@ func setLP(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad LP Fqdn", l}, "" } if rr.Fqdn[l.length-1] != '.' { @@ -2005,14 +2001,14 @@ func setL64(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad L64 Preference", l}, "" } rr.Preference = uint16(i) <-c // zBlank l = <-c // zString u, err := stringToNodeID(l) - if err != nil { + if err != nil || l.err { return nil, err, "" } rr.Locator64 = u @@ -2027,7 +2023,7 @@ func setUID(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad UID Uid", l}, "" } rr.Uid = uint32(i) @@ -2042,7 +2038,7 @@ func setGID(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad GID Gid", l}, "" } rr.Gid = uint32(i) @@ -2069,7 +2065,7 @@ func setPX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } i, e := strconv.Atoi(l.token) - if e != nil { + if e != nil || l.err { return nil, &ParseError{f, "bad PX Preference", l}, "" } rr.Preference = uint16(i) @@ -2084,7 +2080,7 @@ func setPX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad PX Map822", l}, "" } if rr.Map822[l.length-1] != '.' { @@ -2098,7 +2094,7 @@ func setPX(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, "" } _, ok = IsDomainName(l.token) - if !ok || l.length == 0 { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad PX Mapx400", l}, "" } if rr.Mapx400[l.length-1] != '.' { @@ -2115,21 +2111,21 @@ func setIPSECKEY(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) return rr, nil, l.comment } i, err := strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad IPSECKEY Precedence", l}, "" } rr.Precedence = uint8(i) <-c // zBlank l = <-c i, err = strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad IPSECKEY GatewayType", l}, "" } rr.GatewayType = uint8(i) <-c // zBlank l = <-c i, err = strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad IPSECKEY Algorithm", l}, "" } rr.Algorithm = uint8(i) @@ -2146,7 +2142,7 @@ func setIPSECKEY(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) rr.GatewayName = o } _, ok := IsDomainName(l.token) - if !ok { + if !ok || l.length == 0 || l.err { return nil, &ParseError{f, "bad IPSECKEY GatewayName", l}, "" } if rr.GatewayName[l.length-1] != '.' { @@ -2182,7 +2178,7 @@ func setCAA(h RR_Header, c chan lex, o, f string) (RR, *ParseError, string) { return rr, nil, l.comment } i, err := strconv.Atoi(l.token) - if err != nil { + if err != nil || l.err { return nil, &ParseError{f, "bad CAA Flag", l}, "" } rr.Flag = uint8(i) @@ -2245,7 +2241,6 @@ var typeToparserFunc = map[uint16]parserFunc{ TypeNID: parserFunc{setNID, false}, TypeNIMLOC: parserFunc{setNIMLOC, true}, TypeNINFO: parserFunc{setNINFO, true}, - TypeNSAP: parserFunc{setNSAP, true}, TypeNSAPPTR: parserFunc{setNSAPPTR, false}, TypeNSEC3PARAM: parserFunc{setNSEC3PARAM, false}, TypeNSEC3: parserFunc{setNSEC3, true}, diff --git a/Godeps/_workspace/src/github.com/nu7hatch/gouuid/example_test.go b/Godeps/_workspace/src/github.com/nu7hatch/gouuid/example_test.go index 9e86fdc3db5f13b88116e89ff20b993cafac392b..71d657c1c081d39185c9b09658b580a82a1dfcbc 100644 --- a/Godeps/_workspace/src/github.com/nu7hatch/gouuid/example_test.go +++ b/Godeps/_workspace/src/github.com/nu7hatch/gouuid/example_test.go @@ -2,7 +2,7 @@ package uuid_test import ( "fmt" - "github.com/nu7hatch/gouuid" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/nu7hatch/gouuid" ) func ExampleNewV4() { diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/0doc.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/0doc.go index 0f33922b730defc7364d9b38cd31fa63336a343c..dd8b589de070c05de3e2822390c286c0c688a6e5 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/0doc.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/0doc.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. /* High Performance, Feature-Rich Idiomatic Go codec/encoding library for diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/binc.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/binc.go index dc3aa80a9510af3350a63c49349a8fd8c8deb8f4..9dadb0a47b8ace921e5da61abdcc85baaba5bb7d 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/binc.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/binc.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor.go index d9a5ff834f5d8eeb590b1b64984cd0128a22cd65..c3b88da20256522cc79d6f97da1d8969809ee310 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go index b03a9da078a4df1ecb8e99f74babfb2fc62c162b..205dffa7d15b0d7fda6f41d7926cb579e36a6afb 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/cbor_test.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go index 205af445a24ae698a4c040c3a01852adb79433df..cd93556f7d13f7ecede0f306cf6d673c3ee78818 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/codec_test.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen/gen.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen/gen.go index 0a32b6cb3daa72aa137b1bebbbe58cdf28adb13c..892df598f8fd4c618094245305b8d5551d3c42b6 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen/gen.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/codecgen/gen.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. // codecgen generates codec.Selfer implementations for a set of types. package main diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/decode.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/decode.go index d6c0c6d18e0d0d9bac3fd524454ad5db0f90b6bc..a2e35d7a156ac31829501e0b0b092c94d6286af0 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/decode.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/decode.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -748,8 +748,10 @@ func (f decFnInfo) kSlice(rv reflect.Value) { rvlen = containerLenS } } else if containerLenS != rvlen { - rv.SetLen(containerLenS) - rvlen = containerLenS + if f.seq == seqTypeSlice { + rv.SetLen(containerLenS) + rvlen = containerLenS + } } j := 0 for ; j < numToRead; j++ { diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/encode.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/encode.go index 803c9d1827db704a2e92bde324fc59124c9bb495..38c55be4e8a43b3f4b30fbe88a3d8c94283e4211 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/encode.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/encode.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.generated.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.generated.go index efd81da29fa0bab889578f69d9793117d8cc2d6f..b0f7f8070f75200e85de80637cedecac67b0a7de 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.generated.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.generated.go @@ -1,7 +1,7 @@ // //+build ignore // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. // ************************************************************ // DO NOT EDIT. diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.go.tmpl b/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.go.tmpl index 19138c87ab85d79c5c6612120dda7b446d6d073e..9f0adccf83cf41a11c17648de65d4538e4ce02e9 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.go.tmpl +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/fast-path.go.tmpl @@ -1,7 +1,7 @@ // //+build ignore // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. // ************************************************************ // DO NOT EDIT. diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-dec-array.go.tmpl index ffb2cc4f249e5b431a9fe3e470c6f8b496534eef..0f4ea91d21cf1c5024a426981d99f380471d99f9 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-dec-array.go.tmpl +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-dec-array.go.tmpl @@ -1,7 +1,9 @@ -{{var "v"}} := *{{ .Varname }} +{{var "v"}} := {{ if not isArray}}*{{ end }}{{ .Varname }} {{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() -var {{var "c"}} bool +var {{var "c"}} bool +_ = {{var "c"}} + {{ if not isArray }}if {{var "v"}} == nil { if {{var "l"}} <= 0 { {{var "v"}} = make({{ .CTyp }}, 0) @@ -25,7 +27,7 @@ if {{var "l"}} == 0 { {{ if isSlice }} {{ else }} {{var "n"}} := {{var "l"}} if {{var "l"}} > cap({{var "v"}}) { - {{ if isArray }}r.ReadArrayCannotExpand(len({{var "v"}}), {{var "l"}}) + {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) {{var "n"}} = len({{var "v"}}) {{ else }}{{ if .Immutable }} {{var "v2"}} := {{var "v"}} @@ -37,8 +39,8 @@ if {{var "l"}} == 0 { {{ if isSlice }} {{ end }}{{var "c"}} = true {{ end }} } else if {{var "l"}} != len({{var "v"}}) { - {{var "v"}} = {{var "v"}}[:{{var "l"}}] - {{var "c"}} = true + {{ if isSlice }}{{var "v"}} = {{var "v"}}[:{{var "l"}}] + {{var "c"}} = true {{ end }} } {{var "j"}} := 0 for ; {{var "j"}} < {{var "n"}} ; {{var "j"}}++ { @@ -51,7 +53,7 @@ if {{var "l"}} == 0 { {{ if isSlice }} } else { for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { if {{var "j"}} >= len({{var "v"}}) { - {{ if isArray }}r.ReadArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) + {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) {{ else if isSlice}}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} {{var "c"}} = true {{ end }} } @@ -72,6 +74,7 @@ if {{var "l"}} == 0 { {{ if isSlice }} } {{var "h"}}.End() } -if {{var "c"}} { +{{ if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} -} +}{{ end }} + diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.generated.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.generated.go index 1811a4877c878307a5418f9afd4b1fd199b5dadb..ecf3ee54cf8f38f5054f9d8a0a2662448e7dc3f0 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.generated.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.generated.go @@ -1,7 +1,7 @@ // //+build ignore // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. // ************************************************************ // DO NOT EDIT. diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.go.tmpl b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.go.tmpl index 50c029975f4bb84e4412c613ca9ba56bed16af93..89d75185a6642b28791edc9793debccad050102b 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.go.tmpl +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen-helper.go.tmpl @@ -1,7 +1,7 @@ // //+build ignore // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. // ************************************************************ // DO NOT EDIT. diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.generated.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.generated.go index f035401d80e57bbf4bdc6b301857b950ed56bb0e..8cc254ebff0ebb4bdafeeb02cfa920b412a3ff3c 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.generated.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.generated.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -55,10 +55,12 @@ r.ReadMapEnd() ` const genDecListTmpl = ` -{{var "v"}} := *{{ .Varname }} +{{var "v"}} := {{ if not isArray}}*{{ end }}{{ .Varname }} {{var "h"}}, {{var "l"}} := z.DecSliceHelperStart() -var {{var "c"}} bool +var {{var "c"}} bool +_ = {{var "c"}} + {{ if not isArray }}if {{var "v"}} == nil { if {{var "l"}} <= 0 { {{var "v"}} = make({{ .CTyp }}, 0) @@ -82,7 +84,7 @@ if {{var "l"}} == 0 { {{ if isSlice }} {{ else }} {{var "n"}} := {{var "l"}} if {{var "l"}} > cap({{var "v"}}) { - {{ if isArray }}r.ReadArrayCannotExpand(len({{var "v"}}), {{var "l"}}) + {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) {{var "n"}} = len({{var "v"}}) {{ else }}{{ if .Immutable }} {{var "v2"}} := {{var "v"}} @@ -94,8 +96,8 @@ if {{var "l"}} == 0 { {{ if isSlice }} {{ end }}{{var "c"}} = true {{ end }} } else if {{var "l"}} != len({{var "v"}}) { - {{var "v"}} = {{var "v"}}[:{{var "l"}}] - {{var "c"}} = true + {{ if isSlice }}{{var "v"}} = {{var "v"}}[:{{var "l"}}] + {{var "c"}} = true {{ end }} } {{var "j"}} := 0 for ; {{var "j"}} < {{var "n"}} ; {{var "j"}}++ { @@ -108,7 +110,7 @@ if {{var "l"}} == 0 { {{ if isSlice }} } else { for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { if {{var "j"}} >= len({{var "v"}}) { - {{ if isArray }}r.ReadArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) + {{ if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) {{ else if isSlice}}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} {{var "c"}} = true {{ end }} } @@ -129,8 +131,9 @@ if {{var "l"}} == 0 { {{ if isSlice }} } {{var "h"}}.End() } -if {{var "c"}} { +{{ if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} -} +}{{ end }} + ` diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.go index 618eb5740c4cfebdfb8cb3583f4f8c5e943623d7..b1eee33fe0f9476de1c409aa913183639ee2ddfb 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/gen.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -242,13 +242,13 @@ func Gen(w io.Writer, buildTags, pkgName string, useUnsafe bool, typ ...reflect. for t, _ := range x.ts { rtid := reflect.ValueOf(t).Pointer() // generate enc functions for all these slice/map types. - x.linef("func (x %s) enc%s(v %s, e *%sEncoder) {", x.hn, x.genMethodNameT(t), x.genTypeName(t), x.cpfx) + x.linef("func (x %s) enc%s(v %s%s, e *%sEncoder) {", x.hn, x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), x.cpfx) x.genRequiredMethodVars(true) switch t.Kind() { case reflect.Array, reflect.Slice, reflect.Chan: - x.encListFallback("v", rtid, t) + x.encListFallback("v", t) case reflect.Map: - x.encMapFallback("v", rtid, t) + x.encMapFallback("v", t) default: panic(genExpectArrayOrMapErr) } @@ -273,6 +273,13 @@ func Gen(w io.Writer, buildTags, pkgName string, useUnsafe bool, typ ...reflect. x.line("") } +func (x *genRunner) arr2str(t reflect.Type, s string) string { + if t.Kind() == reflect.Array { + return s + } + return "" +} + func (x *genRunner) genRequiredMethodVars(encode bool) { x.line("var h " + x.hn) if encode { @@ -413,9 +420,10 @@ func (x *genRunner) selfer(encode bool) { } +// used for chan, array, slice, map func (x *genRunner) xtraSM(varname string, encode bool, t reflect.Type) { if encode { - x.linef("h.enc%s(%s(%s), e)", x.genMethodNameT(t), x.genTypeName(t), varname) + x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), varname) // x.line("h.enc" + x.genMethodNameT(t) + "(" + x.genTypeName(t) + "(" + varname + "), e)") } else { x.linef("h.dec%s((*%s)(%s), d)", x.genMethodNameT(t), x.genTypeName(t), varname) @@ -424,6 +432,8 @@ func (x *genRunner) xtraSM(varname string, encode bool, t reflect.Type) { x.ts[t] = struct{}{} } +// encVar will encode a variable. +// The parameter, t, is the reflect.Type of the variable itself func (x *genRunner) encVar(varname string, t reflect.Type) { var checkNil bool switch t.Kind() { @@ -435,15 +445,20 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { } switch t.Kind() { case reflect.Ptr: - if t.Elem().Kind() == reflect.Struct { + switch t.Elem().Kind() { + case reflect.Struct, reflect.Array: x.enc(varname, genNonPtr(t)) - } else { + default: i := x.varsfx() x.line(genTempVarPfx + i + " := *" + varname) x.enc(genTempVarPfx+i, genNonPtr(t)) } + case reflect.Struct, reflect.Array: + i := x.varsfx() + x.line(genTempVarPfx + i + " := &" + varname) + x.enc(genTempVarPfx+i, t) default: - x.enc(varname, genNonPtr(t)) + x.enc(varname, t) } if checkNil { @@ -452,6 +467,8 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { } +// enc will encode a variable (varname) of type T, +// except t is of kind reflect.Struct or reflect.Array, wherein varname is of type *T (to prevent copying) func (x *genRunner) enc(varname string, t reflect.Type) { // varName here must be to a pointer to a struct, or to a value directly. rtid := reflect.ValueOf(t).Pointer() @@ -502,9 +519,11 @@ func (x *genRunner) enc(varname string, t reflect.Type) { x.line("r.EncodeBool(bool(" + varname + "))") case reflect.String: x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(" + varname + "))") - case reflect.Array, reflect.Chan: + case reflect.Chan: x.xtraSM(varname, true, t) // x.encListFallback(varname, rtid, t) + case reflect.Array: + x.xtraSM(varname, true, t) case reflect.Slice: // if nil, call dedicated function // if a []uint8, call dedicated function @@ -746,7 +765,7 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { x.line("}") } -func (x *genRunner) encListFallback(varname string, rtid uintptr, t reflect.Type) { +func (x *genRunner) encListFallback(varname string, t reflect.Type) { i := x.varsfx() g := genTempVarPfx x.line("r.EncodeArrayStart(len(" + varname + "))") @@ -774,7 +793,7 @@ func (x *genRunner) encListFallback(varname string, rtid uintptr, t reflect.Type x.line("}") } -func (x *genRunner) encMapFallback(varname string, rtid uintptr, t reflect.Type) { +func (x *genRunner) encMapFallback(varname string, t reflect.Type) { i := x.varsfx() x.line("r.EncodeMapStart(len(" + varname + "))") x.line(genTempVarPfx + "s" + i + " := !z.EncBinary()") diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper.go index 945b4c4987cf1e3ccdb454a10c734ae41c1dd265..7848ea1359b96c7df37d27dd134718771b82dcaf 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_internal.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_internal.go index 7d4e9326a25cf06cbb8e312a7ca68356955a90ff..c865246f499ec9bdc5a96dfae6d8128cdb61933f 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_internal.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_internal.go @@ -1,5 +1,5 @@ -// Copyright (c) 2012, 2013 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_not_unsafe.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_not_unsafe.go index df0503880f932283f27afc6c5523ccca7bb6b4b0..7c2ffc0fde6e635a9e32ce61d9839dbbfcb29df1 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_not_unsafe.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_not_unsafe.go @@ -1,7 +1,7 @@ //+build !unsafe // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go index 8ea6cc5e72341c132f8f28d6e61473dd45e5d29b..685c576c4e3cf036c55476ea784b18a8ff469c7b 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_test.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_unsafe.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_unsafe.go index 3526d4452a6bcb386af66860a16031cddfaae103..d7994961eabbc624888893727e366e9d1d9ae3e1 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_unsafe.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/helper_unsafe.go @@ -1,7 +1,7 @@ //+build unsafe // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/json.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/json.go index c112a79716c89beb7ad716304f20b150fef8c5a6..cb370d48e7dcc2caa02a4dfaa9ed214b7ba97dd1 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/json.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/json.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/msgpack.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/msgpack.go index 299656f53249076ef4797c509232718cf0674986..5cfc2a25910d6f4a45215cfba345c42137ec766e 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/msgpack.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/msgpack.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. /* MSGPACK diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/noop.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/noop.go index 76c01e4d3c8b83339b2b858c4c39acb8f9eae794..25bef4fc3ca00cd17ea96f000b6233856578caa4 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/noop.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/noop.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/prebuild.sh b/Godeps/_workspace/src/github.com/ugorji/go/codec/prebuild.sh index a10e74bdc41658b84d9629b91caecdcb655fdfea..c1916f3038a10753fbf78b9052f0f84a5b1a4ba0 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/prebuild.sh +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/prebuild.sh @@ -54,7 +54,7 @@ _build() { cat > gen.generated.go <<EOF // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -135,16 +135,18 @@ EOF _codegenerators() { if [[ $zforce == "1" || - "1" == $( _needgen "values_msgp${zsfx}" ) - || "1" == $( _needgen "values_codecgen${zsfx}" ) ]] + "1" == $( _needgen "values_codecgen${zsfx}" ) || + "1" == $( _needgen "values_msgp${zsfx}" ) || + "1" == $( _needgen "values_ffjson${zsfx}" ) || + 1 == 0 ]] then true && \ - echo "msgp ... " && \ - msgp -tests=false -pkg=codec -o=values_msgp${zsfx} -file=$zfin && \ echo "codecgen - !unsafe ... " && \ codecgen -rt codecgen -t 'x,codecgen,!unsafe' -o values_codecgen${zsfx} $zfin && \ echo "codecgen - unsafe ... " && \ codecgen -u -rt codecgen -t 'x,codecgen,unsafe' -o values_codecgen_unsafe${zsfx} $zfin && \ + echo "msgp ... " && \ + msgp -tests=false -pkg=codec -o=values_msgp${zsfx} -file=$zfin && \ echo "ffjson ... " && \ ffjson -w values_ffjson${zsfx} $zfin && \ # remove (M|Unm)arshalJSON implementations, so they don't conflict with encoding/json bench \ diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go index c644a6ec577a20a21aa2137125a9c618edd52835..be0374c9901921c4d649965eb4c353a79f232523 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/py_test.go @@ -1,7 +1,7 @@ //+build x // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/rpc.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/rpc.go index 465248541677d97ee2534a53fde9cd0d7d4967a3..dad53d0c61e60e3782ae49ed5404fd252ab19ad7 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/rpc.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/rpc.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/simple.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/simple.go index eefff520a378deba02ca0b3860e9df78ef02950c..e73beee72ce2ffdfdd6d74321eee2b8c69506c8f 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/simple.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/simple.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/time.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/time.go index a6344ed779b438ea551fbf3b63e8aa923bf8897a..733fc3fb75a5a846c5bacceb07ae19be23077db9 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/time.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/time.go @@ -1,5 +1,5 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec diff --git a/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go b/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go index a3d1f399b3ec2a0fa75e80a52c37cac9019ea7ef..4ec28e131c8419e5ddf1934772bf76c9895fe06c 100644 --- a/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go +++ b/Godeps/_workspace/src/github.com/ugorji/go/codec/values_test.go @@ -1,7 +1,7 @@ // // +build testing // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a BSD-style license found in the LICENSE file. +// Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -57,6 +57,11 @@ type TestStruc struct { Iptrslice []*int64 + // TODO: test these separately, specifically for reflection and codecgen. + // Unfortunately, ffjson doesn't support these. Its compilation even fails. + // Ui64array [4]uint64 + // Ui64slicearray [][4]uint64 + AnonInTestStruc //M map[interface{}]interface{} `json:"-",bson:"-"` diff --git a/cmd/radioctl/radioctl.go b/cmd/radioctl/radioctl.go index 28521f14098abfc5eda448fc11b4ff65c52d2125..a30a16d3e01b60080becc980c2f6a1f5c041389b 100644 --- a/cmd/radioctl/radioctl.go +++ b/cmd/radioctl/radioctl.go @@ -12,8 +12,8 @@ import ( "strings" "git.autistici.org/ale/autoradio" - "github.com/gonuts/commander" - gonutsflag "github.com/gonuts/flag" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/commander" + gonutsflag "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/gonuts/flag" ) // Format for output of structured data. diff --git a/coordination/etcdtest/fake_etcd.go b/coordination/etcdtest/fake_etcd.go index a14891af42103edabbe0b11f5621ed664ad3cdc1..a19f46886bc4ef052bb48b72cb44856161811ac1 100644 --- a/coordination/etcdtest/fake_etcd.go +++ b/coordination/etcdtest/fake_etcd.go @@ -12,7 +12,7 @@ import ( "sync" "time" - "github.com/coreos/go-etcd/etcd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd" ) type datum struct { diff --git a/coordination/masterelection/masterelection.go b/coordination/masterelection/masterelection.go index 3b2786e200a2bec9e95f673e71e7fbef35db380c..bd3cb122bb27bf4f4cf59e70e6cf80bc080f0413 100644 --- a/coordination/masterelection/masterelection.go +++ b/coordination/masterelection/masterelection.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/coreos/go-etcd/etcd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd" ) // Possible values for Role. diff --git a/coordination/presence/presence.go b/coordination/presence/presence.go index c99e54cb5e8c423edd9249d4222906c9d6dfd1b5..2b5cd0679c707f5e576990e8dc6fc6665605b94f 100644 --- a/coordination/presence/presence.go +++ b/coordination/presence/presence.go @@ -9,7 +9,7 @@ import ( "log" "time" - "github.com/coreos/go-etcd/etcd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd" ) // EtcdClient is the etcd client interface used by this package. diff --git a/coordination/watcher/cache.go b/coordination/watcher/cache.go index d826239f317f3b0ef4f74fc1d2728e6acf8bc3eb..3abe43c7ef2e2657f06c766ee7b84f653949b284 100644 --- a/coordination/watcher/cache.go +++ b/coordination/watcher/cache.go @@ -3,7 +3,7 @@ package watcher import ( "sync" - "github.com/coreos/go-etcd/etcd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd" ) type DecodeFn func(string) interface{} diff --git a/coordination/watcher/sync.go b/coordination/watcher/sync.go index 60dc37ee22dd97c4303245c6bff875176f3ab4ef..7cda3f87bca07d8e255dd1499df27f3a63e53261 100644 --- a/coordination/watcher/sync.go +++ b/coordination/watcher/sync.go @@ -1,6 +1,6 @@ package watcher -import "github.com/coreos/go-etcd/etcd" +import "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd" // A Syncable is a key/value map that can mirror the contents of a // subdirectory in the etcd database. diff --git a/coordination/watcher/watcher.go b/coordination/watcher/watcher.go index 58543d04dde23c754f882097080c46bfb36012f4..9fac94304028fd27f5979f9a7ef1ae1c1ae9e578 100644 --- a/coordination/watcher/watcher.go +++ b/coordination/watcher/watcher.go @@ -14,7 +14,7 @@ import ( "log" "time" - "github.com/coreos/go-etcd/etcd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd" ) // EtcdClient is the etcd client interface used by this package. diff --git a/etcd_client.go b/etcd_client.go index ab18aa3d5b481fd7c6b19eebb5de59ef6367bcd2..d95a49e7c0ee7661dcd68ab3a63f8c605bd7f0bf 100644 --- a/etcd_client.go +++ b/etcd_client.go @@ -7,7 +7,7 @@ import ( "net" "strings" - "github.com/coreos/go-etcd/etcd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/coreos/go-etcd/etcd" ) var ( diff --git a/fe/dns.go b/fe/dns.go index 45c5b5a84221c51873891281db63fac8d4b34b14..14969c27fd40bc418cd6a9bada7b453e4a0eaf0b 100644 --- a/fe/dns.go +++ b/fe/dns.go @@ -9,8 +9,8 @@ import ( "time" "git.autistici.org/ale/autoradio" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/miekg/dns" "git.autistici.org/ale/autoradio/instrumentation" - "github.com/miekg/dns" ) var ( diff --git a/fe/http.go b/fe/http.go index 2d0854af33195dafd6300e298ad01da03ae17468..a860c9af181a526400f77cacfe5814053d6f14e5 100644 --- a/fe/http.go +++ b/fe/http.go @@ -20,8 +20,8 @@ import ( _ "net/http/pprof" "git.autistici.org/ale/autoradio" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/PuerkitoBio/ghost/handlers" "git.autistici.org/ale/autoradio/instrumentation" - "github.com/PuerkitoBio/ghost/handlers" ) var ( diff --git a/fe/lbv2/lbv2.go b/fe/lbv2/lbv2.go index 031edb032fa028749926a5dfa8e9735b00bbe164..43f4db78ddd0f7e9997019653cfbeb6b6dd1a176 100644 --- a/fe/lbv2/lbv2.go +++ b/fe/lbv2/lbv2.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/jmcvetta/randutil" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/jmcvetta/randutil" ) // Node utilization along a specific dimension. Utilization is treated diff --git a/instrumentation/stats.go b/instrumentation/stats.go index 6ed23abf66f0ac4dcbc5012f0bed0fc55cb21db3..e65a64038fc9c0c1a871c06d0a4e0077dcdf8ad6 100644 --- a/instrumentation/stats.go +++ b/instrumentation/stats.go @@ -7,7 +7,7 @@ import ( "os" "sync" - "github.com/cactus/go-statsd-client/statsd" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/cactus/go-statsd-client/statsd" ) var ( diff --git a/node/icecast_config_test.go b/node/icecast_config_test.go index 970c225e87f5c3dc7d4fcab829fcaee0cdb49bc0..7586f32c71b4e37bc8c9501f2c031950864f6156 100644 --- a/node/icecast_config_test.go +++ b/node/icecast_config_test.go @@ -7,7 +7,7 @@ import ( "testing" "git.autistici.org/ale/autoradio" - "github.com/aryann/difflib" + "git.autistici.org/ale/autoradio/Godeps/_workspace/src/github.com/aryann/difflib" ) const (