mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 05:23:19 -07:00
fix: updated dependencies (fixes some issues with BLE)
This commit is contained in:
parent
f14470c8f6
commit
29c571cf16
311 changed files with 28540 additions and 4279 deletions
61
Gopkg.lock
generated
61
Gopkg.lock
generated
|
@ -18,16 +18,16 @@
|
||||||
revision = "a2896be8c82bb2229d1cf26204863180e34b2b31"
|
revision = "a2896be8c82bb2229d1cf26204863180e34b2b31"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
|
||||||
digest = "1:3a4202162c0d85f2a5fed5675bd35e6686c8b379c63e40ef105bf3e7d76d97f5"
|
digest = "1:3a4202162c0d85f2a5fed5675bd35e6686c8b379c63e40ef105bf3e7d76d97f5"
|
||||||
name = "github.com/antchfx/xpath"
|
name = "github.com/antchfx/xpath"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "ce1d48779e67a1ddfb380995fe532b2e0015919c"
|
revision = "ce1d48779e67a1ddfb380995fe532b2e0015919c"
|
||||||
|
version = "v1.0.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:67f303802ce14d56880d9f2142adc00511441f0fcf7b7fd4ad5856e234963f15"
|
digest = "1:a06ec4a20121f38957a467b3cbf800188da245a51e2821c43f4f24acf8404cff"
|
||||||
name = "github.com/bettercap/gatt"
|
name = "github.com/bettercap/gatt"
|
||||||
packages = [
|
packages = [
|
||||||
".",
|
".",
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
"xpc",
|
"xpc",
|
||||||
]
|
]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "fac16c0ad797bbccae1fe4acf49761b98f7516e7"
|
revision = "5d01ef3cdf3a3802f192f305b913b3adb5ed85d0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
@ -83,11 +83,11 @@
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:d754d24358cf013301a804cdab95cbcbe0da83902dc24ee20e98a899c4dd48e0"
|
digest = "1:83d8ba12385e72ff79d1518e02a3a25e4d0cd6994cc1fe869317af7f4b88c957"
|
||||||
name = "github.com/elazarl/goproxy"
|
name = "github.com/elazarl/goproxy"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "9d40249d3c2f14d1a9d75e070a738362adeb5a83"
|
revision = "473e67f1d7d297e5be759edf6e981768c89529f2"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:a6346055dbca49d489f048f55c6efb0451642c8f94e649160b50e571ac6ce738"
|
digest = "1:a6346055dbca49d489f048f55c6efb0451642c8f94e649160b50e571ac6ce738"
|
||||||
|
@ -154,27 +154,27 @@
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:2ef895ea08a0af10ad6f1e1faf631c82fa5413dcf0ada93eb62ab5ad02df4979"
|
digest = "1:592f10129d14cecdba718efe84a40df7adb1c67f78537cb3ab84b72c9bb0a91e"
|
||||||
name = "github.com/google/gousb"
|
name = "github.com/google/gousb"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "64d82086770b8b671e1e7f162372dd37f1f5efba"
|
revision = "18f4c1d8a750878c4f86ac3d7319b8aa462a79f9"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:d5f97fc268267ec1b61c3453058c738246fc3e746f14b1ae25161513b7367b0c"
|
digest = "1:cbec35fe4d5a4fba369a656a8cd65e244ea2c743007d8f6c1ccb132acf9d1296"
|
||||||
name = "github.com/gorilla/mux"
|
name = "github.com/gorilla/mux"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "c5c6c98bc25355028a63748a498942a6398ccd22"
|
revision = "00bdffe0f3c77e27d2cf6f5c70232a2d3e4d9c15"
|
||||||
version = "v1.7.1"
|
version = "v1.7.3"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:7b5c6e2eeaa9ae5907c391a91c132abfd5c9e8a784a341b5625e750c67e6825d"
|
digest = "1:e62657cca9badaa308d86e7716083e4c5933bb78e30a17743fc67f50be26f6f4"
|
||||||
name = "github.com/gorilla/websocket"
|
name = "github.com/gorilla/websocket"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "66b9c49e59c6c48f0ffce28c2d8b8a5678502c6d"
|
revision = "c3e18be99d19e6b3e8f1559eea2c161a665c4b6b"
|
||||||
version = "v1.4.0"
|
version = "v1.4.1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:89d41e902c8415f538d75e9d3008b286d30fe853ccf32def2dd37b82dd2ade14"
|
digest = "1:89d41e902c8415f538d75e9d3008b286d30fe853ccf32def2dd37b82dd2ade14"
|
||||||
|
@ -217,20 +217,20 @@
|
||||||
version = "v0.9.0"
|
version = "v0.9.0"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:2fa7b0155cd54479a755c629de26f888a918e13f8857a2c442205d825368e084"
|
digest = "1:7c084e0e780596dd2a7e20d25803909a9a43689c153de953520dfbc0b0e51166"
|
||||||
name = "github.com/mattn/go-colorable"
|
name = "github.com/mattn/go-colorable"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "3a70a971f94a22f2fa562ffcc7a0eb45f5daf045"
|
revision = "8029fb3788e5a4a9c00e415f586a6d033f5d38b3"
|
||||||
version = "v0.1.1"
|
version = "v0.1.2"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:e150b5fafbd7607e2d638e4e5cf43aa4100124e5593385147b0a74e2733d8b0d"
|
digest = "1:36325ebb862e0382f2f14feef409ba9351271b89ada286ae56836c603d43b59c"
|
||||||
name = "github.com/mattn/go-isatty"
|
name = "github.com/mattn/go-isatty"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "c2a7a6ca930a4cd0bc33a3f298eb71960732a3a7"
|
revision = "e1f7b56ace729e4a73a29a6b4fac6cd5fcda7ab3"
|
||||||
version = "v0.0.7"
|
version = "v0.0.9"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
|
@ -268,12 +268,12 @@
|
||||||
version = "v1"
|
version = "v1"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:3a3bc3c022d600ed4aced1d220d92c80bf3e42ff5acf95b59839f7af9ac53346"
|
digest = "1:554af29db5f8e97dd01a8d5a3944c6cc3e91a2578a4ae14408d48cb179557e45"
|
||||||
name = "github.com/miekg/dns"
|
name = "github.com/miekg/dns"
|
||||||
packages = ["."]
|
packages = ["."]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "8aa92d4e02c501ba21e26fb92cf2fb9f23f56917"
|
revision = "c67445656579a3c3836047c509073f97022da0ed"
|
||||||
version = "v1.1.9"
|
version = "v1.1.16"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:5d231480e1c64a726869bc4142d270184c419749d34f167646baa21008eb0a79"
|
digest = "1:5d231480e1c64a726869bc4142d270184c419749d34f167646baa21008eb0a79"
|
||||||
|
@ -317,18 +317,18 @@
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:d5891c5bca9c62e5d394ca26491d2b710a1dc08cedeb0ca8f9ac4c3305120b02"
|
digest = "1:cd7e85fc3687e062714febdee3e8efeb00a413a2a620d28908fd0258261d2353"
|
||||||
name = "golang.org/x/crypto"
|
name = "golang.org/x/crypto"
|
||||||
packages = [
|
packages = [
|
||||||
"ed25519",
|
"ed25519",
|
||||||
"ed25519/internal/edwards25519",
|
"ed25519/internal/edwards25519",
|
||||||
]
|
]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "a29dc8fdc73485234dbef99ebedb95d2eced08de"
|
revision = "71b5226ff73902d121cd9dbbdfdb67045a805845"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:c72eab4f1e3a7f4f544d4ab0c973a95893f9b7623617dba96dd4cc56ae96e80a"
|
digest = "1:34afc8319beb13f1fe5cacfddab53332c56f570b36dd409b033ea43153cc8f00"
|
||||||
name = "golang.org/x/net"
|
name = "golang.org/x/net"
|
||||||
packages = [
|
packages = [
|
||||||
"bpf",
|
"bpf",
|
||||||
|
@ -340,15 +340,18 @@
|
||||||
"ipv6",
|
"ipv6",
|
||||||
]
|
]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "9ce7a6920f093fc0b908c4a5f66ae049110f417e"
|
revision = "ba9fcec4b297b415637633c5a6e8fa592e4a16c3"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
branch = "master"
|
branch = "master"
|
||||||
digest = "1:dcd2e9de31e20e01b156288ce4fc239498564295bdbb59d8aaf591af94778162"
|
digest = "1:ee82b03e3db19a6d3ed88db62427809f5dfc18c3bd1afa30f8c2b7e56c6c7565"
|
||||||
name = "golang.org/x/sys"
|
name = "golang.org/x/sys"
|
||||||
packages = ["unix"]
|
packages = [
|
||||||
|
"unix",
|
||||||
|
"windows",
|
||||||
|
]
|
||||||
pruneopts = "UT"
|
pruneopts = "UT"
|
||||||
revision = "d89cdac9e8725f2aefce25fcbfef41134c9ad412"
|
revision = "d223b2b6db03988709bac9e66576ad6ec0d83695"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
digest = "1:9935525a8c49b8434a0b0a54e1980e94a6fae73aaff45c5d33ba8dff69de123e"
|
digest = "1:9935525a8c49b8434a0b0a54e1980e94a6fae73aaff45c5d33ba8dff69de123e"
|
||||||
|
|
61
vendor/github.com/bettercap/gatt/device_darwin.go
generated
vendored
61
vendor/github.com/bettercap/gatt/device_darwin.go
generated
vendored
|
@ -27,6 +27,12 @@ const (
|
||||||
descriptorsDiscovered = 76
|
descriptorsDiscovered = 76
|
||||||
descriptorRead = 79
|
descriptorRead = 79
|
||||||
descriptorWritten = 80
|
descriptorWritten = 80
|
||||||
|
|
||||||
|
peripheralDiscovered_2 = 48
|
||||||
|
peripheralDiscovered_3 = 51
|
||||||
|
|
||||||
|
peripheralConnected_2 = 67
|
||||||
|
characteristicsDiscovered_2 = 89
|
||||||
)
|
)
|
||||||
|
|
||||||
type device struct {
|
type device struct {
|
||||||
|
@ -266,17 +272,47 @@ func (d *device) Scan(ss []UUID, dup bool) {
|
||||||
"kCBScanOptionAllowDuplicates": map[bool]int{true: 1, false: 0}[dup],
|
"kCBScanOptionAllowDuplicates": map[bool]int{true: 1, false: 0}[dup],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
d.sendCmd(29, args)
|
|
||||||
|
msg := 29
|
||||||
|
|
||||||
|
var utsname xpc.Utsname
|
||||||
|
xpc.Uname(&utsname)
|
||||||
|
|
||||||
|
if utsname.Release >= "18." {
|
||||||
|
msg = 46
|
||||||
|
} else if utsname.Release >= "17." {
|
||||||
|
msg = 44
|
||||||
|
}
|
||||||
|
|
||||||
|
d.sendCmd(msg, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *device) StopScanning() {
|
func (d *device) StopScanning() {
|
||||||
d.sendCmd(30, nil)
|
msg := 30
|
||||||
|
|
||||||
|
var utsname xpc.Utsname
|
||||||
|
xpc.Uname(&utsname)
|
||||||
|
|
||||||
|
if utsname.Release >= "18." {
|
||||||
|
msg = 47
|
||||||
|
}
|
||||||
|
|
||||||
|
d.sendCmd(msg, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *device) Connect(p Peripheral) {
|
func (d *device) Connect(p Peripheral) {
|
||||||
|
msg := 31
|
||||||
|
|
||||||
|
var utsname xpc.Utsname
|
||||||
|
xpc.Uname(&utsname)
|
||||||
|
|
||||||
|
if utsname.Release >= "18." {
|
||||||
|
msg = 48
|
||||||
|
}
|
||||||
|
|
||||||
pp := p.(*peripheral)
|
pp := p.(*peripheral)
|
||||||
d.plist[pp.id.String()] = pp
|
d.plist[pp.id.String()] = pp
|
||||||
d.sendCmd(31,
|
d.sendCmd(msg,
|
||||||
xpc.Dict{
|
xpc.Dict{
|
||||||
"kCBMsgArgDeviceUUID": pp.id,
|
"kCBMsgArgDeviceUUID": pp.id,
|
||||||
"kCBMsgArgOptions": xpc.Dict{
|
"kCBMsgArgOptions": xpc.Dict{
|
||||||
|
@ -390,7 +426,8 @@ func (d *device) HandleXpcEvent(event xpc.Dict, err error) {
|
||||||
|
|
||||||
switch id {
|
switch id {
|
||||||
case // device event
|
case // device event
|
||||||
6, // StateChanged
|
4, // StateChanged (new)
|
||||||
|
6, // StateChanged (old)
|
||||||
16, // AdvertisingStarted
|
16, // AdvertisingStarted
|
||||||
17, // AdvertisingStopped
|
17, // AdvertisingStopped
|
||||||
18: // ServiceAdded
|
18: // ServiceAdded
|
||||||
|
@ -404,7 +441,9 @@ func (d *device) HandleXpcEvent(event xpc.Dict, err error) {
|
||||||
23: // Confirmation
|
23: // Confirmation
|
||||||
d.respondToRequest(id, args)
|
d.respondToRequest(id, args)
|
||||||
|
|
||||||
case peripheralDiscovered:
|
case peripheralDiscovered,
|
||||||
|
peripheralDiscovered_2,
|
||||||
|
peripheralDiscovered_3:
|
||||||
xa := args.MustGetDict("kCBMsgArgAdvertisementData")
|
xa := args.MustGetDict("kCBMsgArgAdvertisementData")
|
||||||
if len(xa) == 0 {
|
if len(xa) == 0 {
|
||||||
return
|
return
|
||||||
|
@ -438,7 +477,16 @@ func (d *device) HandleXpcEvent(event xpc.Dict, err error) {
|
||||||
go d.peripheralDiscovered(&peripheral{id: xpc.UUID(u.b), d: d}, a, rssi)
|
go d.peripheralDiscovered(&peripheral{id: xpc.UUID(u.b), d: d}, a, rssi)
|
||||||
}
|
}
|
||||||
|
|
||||||
case peripheralConnected:
|
case peripheralConnected, peripheralConnected_2:
|
||||||
|
var utsname xpc.Utsname
|
||||||
|
xpc.Uname(&utsname)
|
||||||
|
|
||||||
|
if utsname.Release >= "18." {
|
||||||
|
// this is not a connect (it doesn't have kCBMsgArgDeviceUUID,
|
||||||
|
// but instead has kCBAdvDataDeviceAddress)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
u := UUID{args.MustGetUUID("kCBMsgArgDeviceUUID")}
|
u := UUID{args.MustGetUUID("kCBMsgArgDeviceUUID")}
|
||||||
p := &peripheral{
|
p := &peripheral{
|
||||||
id: xpc.UUID(u.b),
|
id: xpc.UUID(u.b),
|
||||||
|
@ -475,6 +523,7 @@ func (d *device) HandleXpcEvent(event xpc.Dict, err error) {
|
||||||
serviceDiscovered,
|
serviceDiscovered,
|
||||||
includedServicesDiscovered,
|
includedServicesDiscovered,
|
||||||
characteristicsDiscovered,
|
characteristicsDiscovered,
|
||||||
|
characteristicsDiscovered_2,
|
||||||
characteristicRead,
|
characteristicRead,
|
||||||
characteristicWritten,
|
characteristicWritten,
|
||||||
notificationValueSet,
|
notificationValueSet,
|
||||||
|
|
12
vendor/github.com/bettercap/gatt/linux/hci.go
generated
vendored
12
vendor/github.com/bettercap/gatt/linux/hci.go
generated
vendored
|
@ -332,6 +332,12 @@ func (h *HCI) handleNumberOfCompletedPkts(b []byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HCI) handleConnection(b []byte) {
|
func (h *HCI) handleConnection(b []byte) {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
log.Printf("error while handling connectiont: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
ep := &evt.LEConnectionCompleteEP{}
|
ep := &evt.LEConnectionCompleteEP{}
|
||||||
if err := ep.Unmarshal(b); err != nil {
|
if err := ep.Unmarshal(b); err != nil {
|
||||||
return // FIXME
|
return // FIXME
|
||||||
|
@ -408,6 +414,12 @@ func (h *HCI) handleLTKRequest(b []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HCI) handleLEMeta(b []byte) error {
|
func (h *HCI) handleLEMeta(b []byte) error {
|
||||||
|
defer func() {
|
||||||
|
if err := recover(); err != nil {
|
||||||
|
log.Printf("error while handling meta: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
code := evt.LEEventCode(b[0])
|
code := evt.LEEventCode(b[0])
|
||||||
switch code {
|
switch code {
|
||||||
case evt.LEConnectionComplete:
|
case evt.LEConnectionComplete:
|
||||||
|
|
7
vendor/github.com/elazarl/goproxy/counterecryptor.go
generated
vendored
7
vendor/github.com/elazarl/goproxy/counterecryptor.go
generated
vendored
|
@ -3,6 +3,7 @@ package goproxy
|
||||||
import (
|
import (
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
|
"crypto/ecdsa"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
|
@ -21,8 +22,12 @@ func NewCounterEncryptorRandFromKey(key interface{}, seed []byte) (r CounterEncr
|
||||||
switch key := key.(type) {
|
switch key := key.(type) {
|
||||||
case *rsa.PrivateKey:
|
case *rsa.PrivateKey:
|
||||||
keyBytes = x509.MarshalPKCS1PrivateKey(key)
|
keyBytes = x509.MarshalPKCS1PrivateKey(key)
|
||||||
|
case *ecdsa.PrivateKey:
|
||||||
|
if keyBytes, err = x509.MarshalECPrivateKey(key); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
err = errors.New("only RSA keys supported")
|
err = errors.New("only RSA and ECDSA keys supported")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
h := sha256.New()
|
h := sha256.New()
|
||||||
|
|
2
vendor/github.com/elazarl/goproxy/doc.go
generated
vendored
2
vendor/github.com/elazarl/goproxy/doc.go
generated
vendored
|
@ -60,7 +60,7 @@ Finally, we have convenience function to throw a quick response
|
||||||
|
|
||||||
proxy.OnResponse(hasGoProxyHeader).DoFunc(func(r*http.Response,ctx *goproxy.ProxyCtx)*http.Response {
|
proxy.OnResponse(hasGoProxyHeader).DoFunc(func(r*http.Response,ctx *goproxy.ProxyCtx)*http.Response {
|
||||||
r.Body.Close()
|
r.Body.Close()
|
||||||
return goproxy.ForbiddenTextResponse(ctx.Req,"Can't see response with X-GoProxy header!")
|
return goproxy.NewResponse(ctx.Req, goproxy.ContentTypeText, http.StatusForbidden, "Can't see response with X-GoProxy header!")
|
||||||
})
|
})
|
||||||
|
|
||||||
we close the body of the original repsonse, and return a new 403 response with a short message.
|
we close the body of the original repsonse, and return a new 403 response with a short message.
|
||||||
|
|
24
vendor/github.com/elazarl/goproxy/proxy.go
generated
vendored
24
vendor/github.com/elazarl/goproxy/proxy.go
generated
vendored
|
@ -118,16 +118,28 @@ func (proxy *ProxyHttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.Error = err
|
ctx.Error = err
|
||||||
resp = proxy.filterResponse(nil, ctx)
|
resp = proxy.filterResponse(nil, ctx)
|
||||||
if resp == nil {
|
|
||||||
ctx.Logf("error read response %v %v:", r.URL.Host, err.Error())
|
|
||||||
http.Error(w, err.Error(), 500)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if resp != nil {
|
||||||
ctx.Logf("Received response %v", resp.Status)
|
ctx.Logf("Received response %v", resp.Status)
|
||||||
}
|
}
|
||||||
origBody := resp.Body
|
}
|
||||||
resp = proxy.filterResponse(resp, ctx)
|
resp = proxy.filterResponse(resp, ctx)
|
||||||
|
|
||||||
|
if resp == nil {
|
||||||
|
var errorString string
|
||||||
|
if ctx.Error != nil {
|
||||||
|
errorString = "error read response " + r.URL.Host + " : " + ctx.Error.Error()
|
||||||
|
ctx.Logf(errorString)
|
||||||
|
http.Error(w, ctx.Error.Error(), 500)
|
||||||
|
} else {
|
||||||
|
errorString = "error read response " + r.URL.Host
|
||||||
|
ctx.Logf(errorString)
|
||||||
|
http.Error(w, errorString, 500)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
origBody := resp.Body
|
||||||
defer origBody.Close()
|
defer origBody.Close()
|
||||||
ctx.Logf("Copying response to client %v [%d]", resp.Status, resp.StatusCode)
|
ctx.Logf("Copying response to client %v [%d]", resp.Status, resp.StatusCode)
|
||||||
// http.ResponseWriter will take care of filling the correct response length
|
// http.ResponseWriter will take care of filling the correct response length
|
||||||
|
|
20
vendor/github.com/elazarl/goproxy/signer.go
generated
vendored
20
vendor/github.com/elazarl/goproxy/signer.go
generated
vendored
|
@ -1,11 +1,15 @@
|
||||||
package goproxy
|
package goproxy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto"
|
||||||
|
"crypto/ecdsa"
|
||||||
|
"crypto/elliptic"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"crypto/sha1"
|
"crypto/sha1"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"crypto/x509/pkix"
|
"crypto/x509/pkix"
|
||||||
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -69,16 +73,28 @@ func signHost(ca tls.Certificate, hosts []string) (cert *tls.Certificate, err er
|
||||||
template.Subject.CommonName = h
|
template.Subject.CommonName = h
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var csprng CounterEncryptorRand
|
var csprng CounterEncryptorRand
|
||||||
if csprng, err = NewCounterEncryptorRandFromKey(ca.PrivateKey, hash); err != nil {
|
if csprng, err = NewCounterEncryptorRandFromKey(ca.PrivateKey, hash); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var certpriv *rsa.PrivateKey
|
|
||||||
|
var certpriv crypto.Signer
|
||||||
|
switch ca.PrivateKey.(type) {
|
||||||
|
case *rsa.PrivateKey:
|
||||||
if certpriv, err = rsa.GenerateKey(&csprng, 2048); err != nil {
|
if certpriv, err = rsa.GenerateKey(&csprng, 2048); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
case *ecdsa.PrivateKey:
|
||||||
|
if certpriv, err = ecdsa.GenerateKey(elliptic.P256(), &csprng); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
err = fmt.Errorf("unsupported key type %T", ca.PrivateKey)
|
||||||
|
}
|
||||||
|
|
||||||
var derBytes []byte
|
var derBytes []byte
|
||||||
if derBytes, err = x509.CreateCertificate(&csprng, &template, x509ca, &certpriv.PublicKey, ca.PrivateKey); err != nil {
|
if derBytes, err = x509.CreateCertificate(&csprng, &template, x509ca, certpriv.Public(), ca.PrivateKey); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return &tls.Certificate{
|
return &tls.Certificate{
|
||||||
|
|
2
vendor/github.com/google/gousb/README.md
generated
vendored
2
vendor/github.com/google/gousb/README.md
generated
vendored
|
@ -40,7 +40,7 @@ Installation
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
You must first install [libusb-1.0]https://github.com/libusb/libusb/wiki). This is pretty straightforward on linux and darwin. The cgo package should be able to find it if you install it in the default manner or use your distribution's package manager. How to tell cgo how to find one installed in a non-default place is beyond the scope of this README.
|
You must first install [libusb-1.0](https://github.com/libusb/libusb/wiki). This is pretty straightforward on linux and darwin. The cgo package should be able to find it if you install it in the default manner or use your distribution's package manager. How to tell cgo how to find one installed in a non-default place is beyond the scope of this README.
|
||||||
|
|
||||||
*Note*: If you are installing this on darwin, you will probably need to run `fixlibusb_darwin.sh /usr/local/lib/libusb-1.0/libusb.h` because of an LLVM incompatibility. It shouldn't break C programs, though I haven't tried it in anger.
|
*Note*: If you are installing this on darwin, you will probably need to run `fixlibusb_darwin.sh /usr/local/lib/libusb-1.0/libusb.h` because of an LLVM incompatibility. It shouldn't break C programs, though I haven't tried it in anger.
|
||||||
|
|
||||||
|
|
4
vendor/github.com/google/gousb/endpoint.go
generated
vendored
4
vendor/github.com/google/gousb/endpoint.go
generated
vendored
|
@ -86,10 +86,6 @@ func (e *endpoint) String() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *endpoint) transfer(ctx context.Context, buf []byte) (int, error) {
|
func (e *endpoint) transfer(ctx context.Context, buf []byte) (int, error) {
|
||||||
if len(buf) == 0 {
|
|
||||||
return 0, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
t, err := newUSBTransfer(e.ctx, e.h, &e.Desc, len(buf))
|
t, err := newUSBTransfer(e.ctx, e.h, &e.Desc, len(buf))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
|
4
vendor/github.com/google/gousb/transfer.go
generated
vendored
4
vendor/github.com/google/gousb/transfer.go
generated
vendored
|
@ -131,7 +131,11 @@ func newUSBTransfer(ctx *Context, dev *libusbDevHandle, ei *EndpointDesc, bufLen
|
||||||
if bufLen < isoPktSize {
|
if bufLen < isoPktSize {
|
||||||
isoPktSize = bufLen
|
isoPktSize = bufLen
|
||||||
}
|
}
|
||||||
|
if isoPktSize > 0 {
|
||||||
isoPackets = bufLen / isoPktSize
|
isoPackets = bufLen / isoPktSize
|
||||||
|
} else {
|
||||||
|
isoPackets = 1
|
||||||
|
}
|
||||||
debug.Printf("New isochronous transfer - buffer length %d, using %d packets of %d bytes each", bufLen, isoPackets, isoPktSize)
|
debug.Printf("New isochronous transfer - buffer length %d, using %d packets of %d bytes each", bufLen, isoPackets, isoPktSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
24
vendor/github.com/gorilla/mux/.travis.yml
generated
vendored
24
vendor/github.com/gorilla/mux/.travis.yml
generated
vendored
|
@ -1,24 +0,0 @@
|
||||||
language: go
|
|
||||||
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- go: 1.7.x
|
|
||||||
- go: 1.8.x
|
|
||||||
- go: 1.9.x
|
|
||||||
- go: 1.10.x
|
|
||||||
- go: 1.11.x
|
|
||||||
- go: 1.x
|
|
||||||
env: LATEST=true
|
|
||||||
- go: tip
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
|
|
||||||
install:
|
|
||||||
- # Skip
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go get -t -v ./...
|
|
||||||
- diff -u <(echo -n) <(gofmt -d .)
|
|
||||||
- if [[ "$LATEST" = true ]]; then go vet .; fi
|
|
||||||
- go test -v -race ./...
|
|
11
vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md
generated
vendored
11
vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md
generated
vendored
|
@ -1,11 +0,0 @@
|
||||||
**What version of Go are you running?** (Paste the output of `go version`)
|
|
||||||
|
|
||||||
|
|
||||||
**What version of gorilla/mux are you at?** (Paste the output of `git rev-parse HEAD` inside `$GOPATH/src/github.com/gorilla/mux`)
|
|
||||||
|
|
||||||
|
|
||||||
**Describe your problem** (and what you have tried so far)
|
|
||||||
|
|
||||||
|
|
||||||
**Paste a minimal, runnable, reproduction of your issue below** (use backticks to format it)
|
|
||||||
|
|
69
vendor/github.com/gorilla/mux/README.md
generated
vendored
69
vendor/github.com/gorilla/mux/README.md
generated
vendored
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
[](https://godoc.org/github.com/gorilla/mux)
|
[](https://godoc.org/github.com/gorilla/mux)
|
||||||
[](https://travis-ci.org/gorilla/mux)
|
[](https://travis-ci.org/gorilla/mux)
|
||||||
|
[](https://circleci.com/gh/gorilla/mux)
|
||||||
[](https://sourcegraph.com/github.com/gorilla/mux?badge)
|
[](https://sourcegraph.com/github.com/gorilla/mux?badge)
|
||||||
|
|
||||||

|

|
||||||
|
@ -29,6 +30,7 @@ The name mux stands for "HTTP request multiplexer". Like the standard `http.Serv
|
||||||
* [Walking Routes](#walking-routes)
|
* [Walking Routes](#walking-routes)
|
||||||
* [Graceful Shutdown](#graceful-shutdown)
|
* [Graceful Shutdown](#graceful-shutdown)
|
||||||
* [Middleware](#middleware)
|
* [Middleware](#middleware)
|
||||||
|
* [Handling CORS Requests](#handling-cors-requests)
|
||||||
* [Testing Handlers](#testing-handlers)
|
* [Testing Handlers](#testing-handlers)
|
||||||
* [Full Example](#full-example)
|
* [Full Example](#full-example)
|
||||||
|
|
||||||
|
@ -491,6 +493,73 @@ r.Use(amw.Middleware)
|
||||||
|
|
||||||
Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. Middlewares _should_ write to `ResponseWriter` if they _are_ going to terminate the request, and they _should not_ write to `ResponseWriter` if they _are not_ going to terminate it.
|
Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. Middlewares _should_ write to `ResponseWriter` if they _are_ going to terminate the request, and they _should not_ write to `ResponseWriter` if they _are not_ going to terminate it.
|
||||||
|
|
||||||
|
### Handling CORS Requests
|
||||||
|
|
||||||
|
[CORSMethodMiddleware](https://godoc.org/github.com/gorilla/mux#CORSMethodMiddleware) intends to make it easier to strictly set the `Access-Control-Allow-Methods` response header.
|
||||||
|
|
||||||
|
* You will still need to use your own CORS handler to set the other CORS headers such as `Access-Control-Allow-Origin`
|
||||||
|
* The middleware will set the `Access-Control-Allow-Methods` header to all the method matchers (e.g. `r.Methods(http.MethodGet, http.MethodPut, http.MethodOptions)` -> `Access-Control-Allow-Methods: GET,PUT,OPTIONS`) on a route
|
||||||
|
* If you do not specify any methods, then:
|
||||||
|
> _Important_: there must be an `OPTIONS` method matcher for the middleware to set the headers.
|
||||||
|
|
||||||
|
Here is an example of using `CORSMethodMiddleware` along with a custom `OPTIONS` handler to set all the required CORS headers:
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
r := mux.NewRouter()
|
||||||
|
|
||||||
|
// IMPORTANT: you must specify an OPTIONS method matcher for the middleware to set CORS headers
|
||||||
|
r.HandleFunc("/foo", fooHandler).Methods(http.MethodGet, http.MethodPut, http.MethodPatch, http.MethodOptions)
|
||||||
|
r.Use(mux.CORSMethodMiddleware(r))
|
||||||
|
|
||||||
|
http.ListenAndServe(":8080", r)
|
||||||
|
}
|
||||||
|
|
||||||
|
func fooHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
|
if r.Method == http.MethodOptions {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w.Write([]byte("foo"))
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
And an request to `/foo` using something like:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl localhost:8080/foo -v
|
||||||
|
```
|
||||||
|
|
||||||
|
Would look like:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
* Trying ::1...
|
||||||
|
* TCP_NODELAY set
|
||||||
|
* Connected to localhost (::1) port 8080 (#0)
|
||||||
|
> GET /foo HTTP/1.1
|
||||||
|
> Host: localhost:8080
|
||||||
|
> User-Agent: curl/7.59.0
|
||||||
|
> Accept: */*
|
||||||
|
>
|
||||||
|
< HTTP/1.1 200 OK
|
||||||
|
< Access-Control-Allow-Methods: GET,PUT,PATCH,OPTIONS
|
||||||
|
< Access-Control-Allow-Origin: *
|
||||||
|
< Date: Fri, 28 Jun 2019 20:13:30 GMT
|
||||||
|
< Content-Length: 3
|
||||||
|
< Content-Type: text/plain; charset=utf-8
|
||||||
|
<
|
||||||
|
* Connection #0 to host localhost left intact
|
||||||
|
foo
|
||||||
|
```
|
||||||
|
|
||||||
### Testing Handlers
|
### Testing Handlers
|
||||||
|
|
||||||
Testing handlers in a Go web application is straightforward, and _mux_ doesn't complicate this any further. Given two files: `endpoints.go` and `endpoints_test.go`, here's how we'd test an application using _mux_.
|
Testing handlers in a Go web application is straightforward, and _mux_ doesn't complicate this any further. Given two files: `endpoints.go` and `endpoints_test.go`, here's how we'd test an application using _mux_.
|
||||||
|
|
2
vendor/github.com/gorilla/mux/doc.go
generated
vendored
2
vendor/github.com/gorilla/mux/doc.go
generated
vendored
|
@ -295,7 +295,7 @@ A more complex authentication middleware, which maps session token to users, cou
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/", handler)
|
r.HandleFunc("/", handler)
|
||||||
|
|
||||||
amw := authenticationMiddleware{}
|
amw := authenticationMiddleware{tokenUsers: make(map[string]string)}
|
||||||
amw.Populate()
|
amw.Populate()
|
||||||
|
|
||||||
r.Use(amw.Middleware)
|
r.Use(amw.Middleware)
|
||||||
|
|
37
vendor/github.com/gorilla/mux/middleware.go
generated
vendored
37
vendor/github.com/gorilla/mux/middleware.go
generated
vendored
|
@ -32,13 +32,30 @@ func (r *Router) useInterface(mw middleware) {
|
||||||
r.middlewares = append(r.middlewares, mw)
|
r.middlewares = append(r.middlewares, mw)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CORSMethodMiddleware sets the Access-Control-Allow-Methods response header
|
// CORSMethodMiddleware automatically sets the Access-Control-Allow-Methods response header
|
||||||
// on a request, by matching routes based only on paths. It also handles
|
// on requests for routes that have an OPTIONS method matcher to all the method matchers on
|
||||||
// OPTIONS requests, by settings Access-Control-Allow-Methods, and then
|
// the route. Routes that do not explicitly handle OPTIONS requests will not be processed
|
||||||
// returning without calling the next http handler.
|
// by the middleware. See examples for usage.
|
||||||
func CORSMethodMiddleware(r *Router) MiddlewareFunc {
|
func CORSMethodMiddleware(r *Router) MiddlewareFunc {
|
||||||
return func(next http.Handler) http.Handler {
|
return func(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
allMethods, err := getAllMethodsForRoute(r, req)
|
||||||
|
if err == nil {
|
||||||
|
for _, v := range allMethods {
|
||||||
|
if v == http.MethodOptions {
|
||||||
|
w.Header().Set("Access-Control-Allow-Methods", strings.Join(allMethods, ","))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
next.ServeHTTP(w, req)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getAllMethodsForRoute returns all the methods from method matchers matching a given
|
||||||
|
// request.
|
||||||
|
func getAllMethodsForRoute(r *Router, req *http.Request) ([]string, error) {
|
||||||
var allMethods []string
|
var allMethods []string
|
||||||
|
|
||||||
err := r.Walk(func(route *Route, _ *Router, _ []*Route) error {
|
err := r.Walk(func(route *Route, _ *Router, _ []*Route) error {
|
||||||
|
@ -58,15 +75,5 @@ func CORSMethodMiddleware(r *Router) MiddlewareFunc {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
if err == nil {
|
return allMethods, err
|
||||||
w.Header().Set("Access-Control-Allow-Methods", strings.Join(append(allMethods, "OPTIONS"), ","))
|
|
||||||
|
|
||||||
if req.Method == "OPTIONS" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
next.ServeHTTP(w, req)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
23
vendor/github.com/gorilla/mux/regexp.go
generated
vendored
23
vendor/github.com/gorilla/mux/regexp.go
generated
vendored
|
@ -113,6 +113,13 @@ func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*ro
|
||||||
if typ != regexpTypePrefix {
|
if typ != regexpTypePrefix {
|
||||||
pattern.WriteByte('$')
|
pattern.WriteByte('$')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var wildcardHostPort bool
|
||||||
|
if typ == regexpTypeHost {
|
||||||
|
if !strings.Contains(pattern.String(), ":") {
|
||||||
|
wildcardHostPort = true
|
||||||
|
}
|
||||||
|
}
|
||||||
reverse.WriteString(raw)
|
reverse.WriteString(raw)
|
||||||
if endSlash {
|
if endSlash {
|
||||||
reverse.WriteByte('/')
|
reverse.WriteByte('/')
|
||||||
|
@ -138,6 +145,7 @@ func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*ro
|
||||||
reverse: reverse.String(),
|
reverse: reverse.String(),
|
||||||
varsN: varsN,
|
varsN: varsN,
|
||||||
varsR: varsR,
|
varsR: varsR,
|
||||||
|
wildcardHostPort: wildcardHostPort,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,11 +166,22 @@ type routeRegexp struct {
|
||||||
varsN []string
|
varsN []string
|
||||||
// Variable regexps (validators).
|
// Variable regexps (validators).
|
||||||
varsR []*regexp.Regexp
|
varsR []*regexp.Regexp
|
||||||
|
// Wildcard host-port (no strict port match in hostname)
|
||||||
|
wildcardHostPort bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match matches the regexp against the URL host or path.
|
// Match matches the regexp against the URL host or path.
|
||||||
func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
|
func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
|
||||||
if r.regexpType != regexpTypeHost {
|
if r.regexpType == regexpTypeHost {
|
||||||
|
host := getHost(req)
|
||||||
|
if r.wildcardHostPort {
|
||||||
|
// Don't be strict on the port match
|
||||||
|
if i := strings.Index(host, ":"); i != -1 {
|
||||||
|
host = host[:i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return r.regexp.MatchString(host)
|
||||||
|
} else {
|
||||||
if r.regexpType == regexpTypeQuery {
|
if r.regexpType == regexpTypeQuery {
|
||||||
return r.matchQueryString(req)
|
return r.matchQueryString(req)
|
||||||
}
|
}
|
||||||
|
@ -172,8 +191,6 @@ func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool {
|
||||||
}
|
}
|
||||||
return r.regexp.MatchString(path)
|
return r.regexp.MatchString(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.regexp.MatchString(getHost(req))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// url builds a URL part using the given values.
|
// url builds a URL part using the given values.
|
||||||
|
|
19
vendor/github.com/gorilla/websocket/.travis.yml
generated
vendored
19
vendor/github.com/gorilla/websocket/.travis.yml
generated
vendored
|
@ -1,19 +0,0 @@
|
||||||
language: go
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- go: 1.7.x
|
|
||||||
- go: 1.8.x
|
|
||||||
- go: 1.9.x
|
|
||||||
- go: 1.10.x
|
|
||||||
- go: 1.11.x
|
|
||||||
- go: tip
|
|
||||||
allow_failures:
|
|
||||||
- go: tip
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go get -t -v ./...
|
|
||||||
- diff -u <(echo -n) <(gofmt -d .)
|
|
||||||
- go vet $(go list ./... | grep -v /vendor/)
|
|
||||||
- go test -v -race ./...
|
|
10
vendor/github.com/gorilla/websocket/README.md
generated
vendored
10
vendor/github.com/gorilla/websocket/README.md
generated
vendored
|
@ -1,11 +1,11 @@
|
||||||
# Gorilla WebSocket
|
# Gorilla WebSocket
|
||||||
|
|
||||||
|
[](https://godoc.org/github.com/gorilla/websocket)
|
||||||
|
[](https://circleci.com/gh/gorilla/websocket)
|
||||||
|
|
||||||
Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
|
Gorilla WebSocket is a [Go](http://golang.org/) implementation of the
|
||||||
[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
|
[WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol.
|
||||||
|
|
||||||
[](https://travis-ci.org/gorilla/websocket)
|
|
||||||
[](https://godoc.org/github.com/gorilla/websocket)
|
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
* [API Reference](http://godoc.org/github.com/gorilla/websocket)
|
* [API Reference](http://godoc.org/github.com/gorilla/websocket)
|
||||||
|
@ -27,7 +27,7 @@ package API is stable.
|
||||||
### Protocol Compliance
|
### Protocol Compliance
|
||||||
|
|
||||||
The Gorilla WebSocket package passes the server tests in the [Autobahn Test
|
The Gorilla WebSocket package passes the server tests in the [Autobahn Test
|
||||||
Suite](http://autobahn.ws/testsuite) using the application in the [examples/autobahn
|
Suite](https://github.com/crossbario/autobahn-testsuite) using the application in the [examples/autobahn
|
||||||
subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn).
|
subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn).
|
||||||
|
|
||||||
### Gorilla WebSocket compared with other packages
|
### Gorilla WebSocket compared with other packages
|
||||||
|
@ -40,7 +40,7 @@ subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<tr><td colspan="3"><a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> Features</td></tr>
|
<tr><td colspan="3"><a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> Features</td></tr>
|
||||||
<tr><td>Passes <a href="http://autobahn.ws/testsuite/">Autobahn Test Suite</a></td><td><a href="https://github.com/gorilla/websocket/tree/master/examples/autobahn">Yes</a></td><td>No</td></tr>
|
<tr><td>Passes <a href="https://github.com/crossbario/autobahn-testsuite">Autobahn Test Suite</a></td><td><a href="https://github.com/gorilla/websocket/tree/master/examples/autobahn">Yes</a></td><td>No</td></tr>
|
||||||
<tr><td>Receive <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmented</a> message<td>Yes</td><td><a href="https://code.google.com/p/go/issues/detail?id=7632">No</a>, see note 1</td></tr>
|
<tr><td>Receive <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmented</a> message<td>Yes</td><td><a href="https://code.google.com/p/go/issues/detail?id=7632">No</a>, see note 1</td></tr>
|
||||||
<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">close</a> message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=4588">No</a></td></tr>
|
<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">close</a> message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=4588">No</a></td></tr>
|
||||||
<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.2">pings</a> and receive <a href="https://tools.ietf.org/html/rfc6455#section-5.5.3">pongs</a></td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td>No</td></tr>
|
<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.2">pings</a> and receive <a href="https://tools.ietf.org/html/rfc6455#section-5.5.3">pongs</a></td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td>No</td></tr>
|
||||||
|
|
4
vendor/github.com/gorilla/websocket/client.go
generated
vendored
4
vendor/github.com/gorilla/websocket/client.go
generated
vendored
|
@ -70,7 +70,7 @@ type Dialer struct {
|
||||||
// HandshakeTimeout specifies the duration for the handshake to complete.
|
// HandshakeTimeout specifies the duration for the handshake to complete.
|
||||||
HandshakeTimeout time.Duration
|
HandshakeTimeout time.Duration
|
||||||
|
|
||||||
// ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer
|
// ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer
|
||||||
// size is zero, then a useful default size is used. The I/O buffer sizes
|
// size is zero, then a useful default size is used. The I/O buffer sizes
|
||||||
// do not limit the size of the messages that can be sent or received.
|
// do not limit the size of the messages that can be sent or received.
|
||||||
ReadBufferSize, WriteBufferSize int
|
ReadBufferSize, WriteBufferSize int
|
||||||
|
@ -140,7 +140,7 @@ var nilDialer = *DefaultDialer
|
||||||
// Use the response.Header to get the selected subprotocol
|
// Use the response.Header to get the selected subprotocol
|
||||||
// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
|
// (Sec-WebSocket-Protocol) and cookies (Set-Cookie).
|
||||||
//
|
//
|
||||||
// The context will be used in the request and in the Dialer
|
// The context will be used in the request and in the Dialer.
|
||||||
//
|
//
|
||||||
// If the WebSocket handshake fails, ErrBadHandshake is returned along with a
|
// If the WebSocket handshake fails, ErrBadHandshake is returned along with a
|
||||||
// non-nil *http.Response so that callers can handle redirects, authentication,
|
// non-nil *http.Response so that callers can handle redirects, authentication,
|
||||||
|
|
104
vendor/github.com/gorilla/websocket/conn.go
generated
vendored
104
vendor/github.com/gorilla/websocket/conn.go
generated
vendored
|
@ -263,7 +263,9 @@ type Conn struct {
|
||||||
reader io.ReadCloser // the current reader returned to the application
|
reader io.ReadCloser // the current reader returned to the application
|
||||||
readErr error
|
readErr error
|
||||||
br *bufio.Reader
|
br *bufio.Reader
|
||||||
readRemaining int64 // bytes remaining in current frame.
|
// bytes remaining in current frame.
|
||||||
|
// set setReadRemaining to safely update this value and prevent overflow
|
||||||
|
readRemaining int64
|
||||||
readFinal bool // true the current message has more frames.
|
readFinal bool // true the current message has more frames.
|
||||||
readLength int64 // Message size.
|
readLength int64 // Message size.
|
||||||
readLimit int64 // Maximum message size.
|
readLimit int64 // Maximum message size.
|
||||||
|
@ -320,6 +322,17 @@ func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int,
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setReadRemaining tracks the number of bytes remaining on the connection. If n
|
||||||
|
// overflows, an ErrReadLimit is returned.
|
||||||
|
func (c *Conn) setReadRemaining(n int64) error {
|
||||||
|
if n < 0 {
|
||||||
|
return ErrReadLimit
|
||||||
|
}
|
||||||
|
|
||||||
|
c.readRemaining = n
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Subprotocol returns the negotiated protocol for the connection.
|
// Subprotocol returns the negotiated protocol for the connection.
|
||||||
func (c *Conn) Subprotocol() string {
|
func (c *Conn) Subprotocol() string {
|
||||||
return c.subprotocol
|
return c.subprotocol
|
||||||
|
@ -451,7 +464,8 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Conn) prepWrite(messageType int) error {
|
// beginMessage prepares a connection and message writer for a new message.
|
||||||
|
func (c *Conn) beginMessage(mw *messageWriter, messageType int) error {
|
||||||
// Close previous writer if not already closed by the application. It's
|
// Close previous writer if not already closed by the application. It's
|
||||||
// probably better to return an error in this situation, but we cannot
|
// probably better to return an error in this situation, but we cannot
|
||||||
// change this without breaking existing applications.
|
// change this without breaking existing applications.
|
||||||
|
@ -471,6 +485,10 @@ func (c *Conn) prepWrite(messageType int) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mw.c = c
|
||||||
|
mw.frameType = messageType
|
||||||
|
mw.pos = maxFrameHeaderSize
|
||||||
|
|
||||||
if c.writeBuf == nil {
|
if c.writeBuf == nil {
|
||||||
wpd, ok := c.writePool.Get().(writePoolData)
|
wpd, ok := c.writePool.Get().(writePoolData)
|
||||||
if ok {
|
if ok {
|
||||||
|
@ -491,16 +509,11 @@ func (c *Conn) prepWrite(messageType int) error {
|
||||||
// All message types (TextMessage, BinaryMessage, CloseMessage, PingMessage and
|
// All message types (TextMessage, BinaryMessage, CloseMessage, PingMessage and
|
||||||
// PongMessage) are supported.
|
// PongMessage) are supported.
|
||||||
func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) {
|
func (c *Conn) NextWriter(messageType int) (io.WriteCloser, error) {
|
||||||
if err := c.prepWrite(messageType); err != nil {
|
var mw messageWriter
|
||||||
|
if err := c.beginMessage(&mw, messageType); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
c.writer = &mw
|
||||||
mw := &messageWriter{
|
|
||||||
c: c,
|
|
||||||
frameType: messageType,
|
|
||||||
pos: maxFrameHeaderSize,
|
|
||||||
}
|
|
||||||
c.writer = mw
|
|
||||||
if c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) {
|
if c.newCompressionWriter != nil && c.enableWriteCompression && isData(messageType) {
|
||||||
w := c.newCompressionWriter(c.writer, c.compressionLevel)
|
w := c.newCompressionWriter(c.writer, c.compressionLevel)
|
||||||
mw.compress = true
|
mw.compress = true
|
||||||
|
@ -517,10 +530,16 @@ type messageWriter struct {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *messageWriter) fatal(err error) error {
|
func (w *messageWriter) endMessage(err error) error {
|
||||||
if w.err != nil {
|
if w.err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
c := w.c
|
||||||
w.err = err
|
w.err = err
|
||||||
w.c.writer = nil
|
c.writer = nil
|
||||||
|
if c.writePool != nil {
|
||||||
|
c.writePool.Put(writePoolData{buf: c.writeBuf})
|
||||||
|
c.writeBuf = nil
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -534,7 +553,7 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error {
|
||||||
// Check for invalid control frames.
|
// Check for invalid control frames.
|
||||||
if isControl(w.frameType) &&
|
if isControl(w.frameType) &&
|
||||||
(!final || length > maxControlFramePayloadSize) {
|
(!final || length > maxControlFramePayloadSize) {
|
||||||
return w.fatal(errInvalidControlFrame)
|
return w.endMessage(errInvalidControlFrame)
|
||||||
}
|
}
|
||||||
|
|
||||||
b0 := byte(w.frameType)
|
b0 := byte(w.frameType)
|
||||||
|
@ -579,7 +598,7 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error {
|
||||||
copy(c.writeBuf[maxFrameHeaderSize-4:], key[:])
|
copy(c.writeBuf[maxFrameHeaderSize-4:], key[:])
|
||||||
maskBytes(key, 0, c.writeBuf[maxFrameHeaderSize:w.pos])
|
maskBytes(key, 0, c.writeBuf[maxFrameHeaderSize:w.pos])
|
||||||
if len(extra) > 0 {
|
if len(extra) > 0 {
|
||||||
return c.writeFatal(errors.New("websocket: internal error, extra used in client mode"))
|
return w.endMessage(c.writeFatal(errors.New("websocket: internal error, extra used in client mode")))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,15 +619,11 @@ func (w *messageWriter) flushFrame(final bool, extra []byte) error {
|
||||||
c.isWriting = false
|
c.isWriting = false
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return w.fatal(err)
|
return w.endMessage(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if final {
|
if final {
|
||||||
c.writer = nil
|
w.endMessage(errWriteClosed)
|
||||||
if c.writePool != nil {
|
|
||||||
c.writePool.Put(writePoolData{buf: c.writeBuf})
|
|
||||||
c.writeBuf = nil
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,11 +721,7 @@ func (w *messageWriter) Close() error {
|
||||||
if w.err != nil {
|
if w.err != nil {
|
||||||
return w.err
|
return w.err
|
||||||
}
|
}
|
||||||
if err := w.flushFrame(true, nil); err != nil {
|
return w.flushFrame(true, nil)
|
||||||
return err
|
|
||||||
}
|
|
||||||
w.err = errWriteClosed
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WritePreparedMessage writes prepared message into connection.
|
// WritePreparedMessage writes prepared message into connection.
|
||||||
|
@ -742,10 +753,10 @@ func (c *Conn) WriteMessage(messageType int, data []byte) error {
|
||||||
if c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) {
|
if c.isServer && (c.newCompressionWriter == nil || !c.enableWriteCompression) {
|
||||||
// Fast path with no allocations and single frame.
|
// Fast path with no allocations and single frame.
|
||||||
|
|
||||||
if err := c.prepWrite(messageType); err != nil {
|
var mw messageWriter
|
||||||
|
if err := c.beginMessage(&mw, messageType); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
mw := messageWriter{c: c, frameType: messageType, pos: maxFrameHeaderSize}
|
|
||||||
n := copy(c.writeBuf[mw.pos:], data)
|
n := copy(c.writeBuf[mw.pos:], data)
|
||||||
mw.pos += n
|
mw.pos += n
|
||||||
data = data[n:]
|
data = data[n:]
|
||||||
|
@ -792,7 +803,7 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||||
final := p[0]&finalBit != 0
|
final := p[0]&finalBit != 0
|
||||||
frameType := int(p[0] & 0xf)
|
frameType := int(p[0] & 0xf)
|
||||||
mask := p[1]&maskBit != 0
|
mask := p[1]&maskBit != 0
|
||||||
c.readRemaining = int64(p[1] & 0x7f)
|
c.setReadRemaining(int64(p[1] & 0x7f))
|
||||||
|
|
||||||
c.readDecompress = false
|
c.readDecompress = false
|
||||||
if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 {
|
if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 {
|
||||||
|
@ -826,7 +837,17 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||||
return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType))
|
return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Read and parse frame length.
|
// 3. Read and parse frame length as per
|
||||||
|
// https://tools.ietf.org/html/rfc6455#section-5.2
|
||||||
|
//
|
||||||
|
// The length of the "Payload data", in bytes: if 0-125, that is the payload
|
||||||
|
// length.
|
||||||
|
// - If 126, the following 2 bytes interpreted as a 16-bit unsigned
|
||||||
|
// integer are the payload length.
|
||||||
|
// - If 127, the following 8 bytes interpreted as
|
||||||
|
// a 64-bit unsigned integer (the most significant bit MUST be 0) are the
|
||||||
|
// payload length. Multibyte length quantities are expressed in network byte
|
||||||
|
// order.
|
||||||
|
|
||||||
switch c.readRemaining {
|
switch c.readRemaining {
|
||||||
case 126:
|
case 126:
|
||||||
|
@ -834,13 +855,19 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return noFrame, err
|
return noFrame, err
|
||||||
}
|
}
|
||||||
c.readRemaining = int64(binary.BigEndian.Uint16(p))
|
|
||||||
|
if err := c.setReadRemaining(int64(binary.BigEndian.Uint16(p))); err != nil {
|
||||||
|
return noFrame, err
|
||||||
|
}
|
||||||
case 127:
|
case 127:
|
||||||
p, err := c.read(8)
|
p, err := c.read(8)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return noFrame, err
|
return noFrame, err
|
||||||
}
|
}
|
||||||
c.readRemaining = int64(binary.BigEndian.Uint64(p))
|
|
||||||
|
if err := c.setReadRemaining(int64(binary.BigEndian.Uint64(p))); err != nil {
|
||||||
|
return noFrame, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Handle frame masking.
|
// 4. Handle frame masking.
|
||||||
|
@ -863,6 +890,12 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||||
if frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage {
|
if frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage {
|
||||||
|
|
||||||
c.readLength += c.readRemaining
|
c.readLength += c.readRemaining
|
||||||
|
// Don't allow readLength to overflow in the presence of a large readRemaining
|
||||||
|
// counter.
|
||||||
|
if c.readLength < 0 {
|
||||||
|
return noFrame, ErrReadLimit
|
||||||
|
}
|
||||||
|
|
||||||
if c.readLimit > 0 && c.readLength > c.readLimit {
|
if c.readLimit > 0 && c.readLength > c.readLimit {
|
||||||
c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait))
|
c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait))
|
||||||
return noFrame, ErrReadLimit
|
return noFrame, ErrReadLimit
|
||||||
|
@ -876,7 +909,7 @@ func (c *Conn) advanceFrame() (int, error) {
|
||||||
var payload []byte
|
var payload []byte
|
||||||
if c.readRemaining > 0 {
|
if c.readRemaining > 0 {
|
||||||
payload, err = c.read(int(c.readRemaining))
|
payload, err = c.read(int(c.readRemaining))
|
||||||
c.readRemaining = 0
|
c.setReadRemaining(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return noFrame, err
|
return noFrame, err
|
||||||
}
|
}
|
||||||
|
@ -949,6 +982,7 @@ func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
|
||||||
c.readErr = hideTempErr(err)
|
c.readErr = hideTempErr(err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if frameType == TextMessage || frameType == BinaryMessage {
|
if frameType == TextMessage || frameType == BinaryMessage {
|
||||||
c.messageReader = &messageReader{c}
|
c.messageReader = &messageReader{c}
|
||||||
c.reader = c.messageReader
|
c.reader = c.messageReader
|
||||||
|
@ -989,7 +1023,9 @@ func (r *messageReader) Read(b []byte) (int, error) {
|
||||||
if c.isServer {
|
if c.isServer {
|
||||||
c.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n])
|
c.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n])
|
||||||
}
|
}
|
||||||
c.readRemaining -= int64(n)
|
rem := c.readRemaining
|
||||||
|
rem -= int64(n)
|
||||||
|
c.setReadRemaining(rem)
|
||||||
if c.readRemaining > 0 && c.readErr == io.EOF {
|
if c.readRemaining > 0 && c.readErr == io.EOF {
|
||||||
c.readErr = errUnexpectedEOF
|
c.readErr = errUnexpectedEOF
|
||||||
}
|
}
|
||||||
|
@ -1041,7 +1077,7 @@ func (c *Conn) SetReadDeadline(t time.Time) error {
|
||||||
return c.conn.SetReadDeadline(t)
|
return c.conn.SetReadDeadline(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetReadLimit sets the maximum size for a message read from the peer. If a
|
// SetReadLimit sets the maximum size in bytes for a message read from the peer. If a
|
||||||
// message exceeds the limit, the connection sends a close message to the peer
|
// message exceeds the limit, the connection sends a close message to the peer
|
||||||
// and returns ErrReadLimit to the application.
|
// and returns ErrReadLimit to the application.
|
||||||
func (c *Conn) SetReadLimit(limit int64) {
|
func (c *Conn) SetReadLimit(limit int64) {
|
||||||
|
|
47
vendor/github.com/gorilla/websocket/doc.go
generated
vendored
47
vendor/github.com/gorilla/websocket/doc.go
generated
vendored
|
@ -151,6 +151,53 @@
|
||||||
// checking. The application is responsible for checking the Origin header
|
// checking. The application is responsible for checking the Origin header
|
||||||
// before calling the Upgrade function.
|
// before calling the Upgrade function.
|
||||||
//
|
//
|
||||||
|
// Buffers
|
||||||
|
//
|
||||||
|
// Connections buffer network input and output to reduce the number
|
||||||
|
// of system calls when reading or writing messages.
|
||||||
|
//
|
||||||
|
// Write buffers are also used for constructing WebSocket frames. See RFC 6455,
|
||||||
|
// Section 5 for a discussion of message framing. A WebSocket frame header is
|
||||||
|
// written to the network each time a write buffer is flushed to the network.
|
||||||
|
// Decreasing the size of the write buffer can increase the amount of framing
|
||||||
|
// overhead on the connection.
|
||||||
|
//
|
||||||
|
// The buffer sizes in bytes are specified by the ReadBufferSize and
|
||||||
|
// WriteBufferSize fields in the Dialer and Upgrader. The Dialer uses a default
|
||||||
|
// size of 4096 when a buffer size field is set to zero. The Upgrader reuses
|
||||||
|
// buffers created by the HTTP server when a buffer size field is set to zero.
|
||||||
|
// The HTTP server buffers have a size of 4096 at the time of this writing.
|
||||||
|
//
|
||||||
|
// The buffer sizes do not limit the size of a message that can be read or
|
||||||
|
// written by a connection.
|
||||||
|
//
|
||||||
|
// Buffers are held for the lifetime of the connection by default. If the
|
||||||
|
// Dialer or Upgrader WriteBufferPool field is set, then a connection holds the
|
||||||
|
// write buffer only when writing a message.
|
||||||
|
//
|
||||||
|
// Applications should tune the buffer sizes to balance memory use and
|
||||||
|
// performance. Increasing the buffer size uses more memory, but can reduce the
|
||||||
|
// number of system calls to read or write the network. In the case of writing,
|
||||||
|
// increasing the buffer size can reduce the number of frame headers written to
|
||||||
|
// the network.
|
||||||
|
//
|
||||||
|
// Some guidelines for setting buffer parameters are:
|
||||||
|
//
|
||||||
|
// Limit the buffer sizes to the maximum expected message size. Buffers larger
|
||||||
|
// than the largest message do not provide any benefit.
|
||||||
|
//
|
||||||
|
// Depending on the distribution of message sizes, setting the buffer size to
|
||||||
|
// to a value less than the maximum expected message size can greatly reduce
|
||||||
|
// memory use with a small impact on performance. Here's an example: If 99% of
|
||||||
|
// the messages are smaller than 256 bytes and the maximum message size is 512
|
||||||
|
// bytes, then a buffer size of 256 bytes will result in 1.01 more system calls
|
||||||
|
// than a buffer size of 512 bytes. The memory savings is 50%.
|
||||||
|
//
|
||||||
|
// A write buffer pool is useful when the application has a modest number
|
||||||
|
// writes over a large number of connections. when buffers are pooled, a larger
|
||||||
|
// buffer size has a reduced impact on total memory use and has the benefit of
|
||||||
|
// reducing system calls and frame overhead.
|
||||||
|
//
|
||||||
// Compression EXPERIMENTAL
|
// Compression EXPERIMENTAL
|
||||||
//
|
//
|
||||||
// Per message compression extensions (RFC 7692) are experimentally supported
|
// Per message compression extensions (RFC 7692) are experimentally supported
|
||||||
|
|
3
vendor/github.com/gorilla/websocket/go.mod
generated
vendored
Normal file
3
vendor/github.com/gorilla/websocket/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
module github.com/gorilla/websocket
|
||||||
|
|
||||||
|
go 1.12
|
2
vendor/github.com/gorilla/websocket/go.sum
generated
vendored
Normal file
2
vendor/github.com/gorilla/websocket/go.sum
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||||
|
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
42
vendor/github.com/gorilla/websocket/join.go
generated
vendored
Normal file
42
vendor/github.com/gorilla/websocket/join.go
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright 2019 The Gorilla WebSocket Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package websocket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// JoinMessages concatenates received messages to create a single io.Reader.
|
||||||
|
// The string term is appended to each message. The returned reader does not
|
||||||
|
// support concurrent calls to the Read method.
|
||||||
|
func JoinMessages(c *Conn, term string) io.Reader {
|
||||||
|
return &joinReader{c: c, term: term}
|
||||||
|
}
|
||||||
|
|
||||||
|
type joinReader struct {
|
||||||
|
c *Conn
|
||||||
|
term string
|
||||||
|
r io.Reader
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *joinReader) Read(p []byte) (int, error) {
|
||||||
|
if r.r == nil {
|
||||||
|
var err error
|
||||||
|
_, r.r, err = r.c.NextReader()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if r.term != "" {
|
||||||
|
r.r = io.MultiReader(r.r, strings.NewReader(r.term))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n, err := r.r.Read(p)
|
||||||
|
if err == io.EOF {
|
||||||
|
err = nil
|
||||||
|
r.r = nil
|
||||||
|
}
|
||||||
|
return n, err
|
||||||
|
}
|
6
vendor/github.com/gorilla/websocket/proxy.go
generated
vendored
6
vendor/github.com/gorilla/websocket/proxy.go
generated
vendored
|
@ -22,18 +22,18 @@ func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) {
|
proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) {
|
||||||
return &httpProxyDialer{proxyURL: proxyURL, fowardDial: forwardDialer.Dial}, nil
|
return &httpProxyDialer{proxyURL: proxyURL, forwardDial: forwardDialer.Dial}, nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
type httpProxyDialer struct {
|
type httpProxyDialer struct {
|
||||||
proxyURL *url.URL
|
proxyURL *url.URL
|
||||||
fowardDial func(network, addr string) (net.Conn, error)
|
forwardDial func(network, addr string) (net.Conn, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) {
|
func (hpd *httpProxyDialer) Dial(network string, addr string) (net.Conn, error) {
|
||||||
hostPort, _ := hostPortNoPort(hpd.proxyURL)
|
hostPort, _ := hostPortNoPort(hpd.proxyURL)
|
||||||
conn, err := hpd.fowardDial(network, hostPort)
|
conn, err := hpd.forwardDial(network, hostPort)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
4
vendor/github.com/gorilla/websocket/server.go
generated
vendored
4
vendor/github.com/gorilla/websocket/server.go
generated
vendored
|
@ -27,7 +27,7 @@ type Upgrader struct {
|
||||||
// HandshakeTimeout specifies the duration for the handshake to complete.
|
// HandshakeTimeout specifies the duration for the handshake to complete.
|
||||||
HandshakeTimeout time.Duration
|
HandshakeTimeout time.Duration
|
||||||
|
|
||||||
// ReadBufferSize and WriteBufferSize specify I/O buffer sizes. If a buffer
|
// ReadBufferSize and WriteBufferSize specify I/O buffer sizes in bytes. If a buffer
|
||||||
// size is zero, then buffers allocated by the HTTP server are used. The
|
// size is zero, then buffers allocated by the HTTP server are used. The
|
||||||
// I/O buffer sizes do not limit the size of the messages that can be sent
|
// I/O buffer sizes do not limit the size of the messages that can be sent
|
||||||
// or received.
|
// or received.
|
||||||
|
@ -153,7 +153,7 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade
|
||||||
|
|
||||||
challengeKey := r.Header.Get("Sec-Websocket-Key")
|
challengeKey := r.Header.Get("Sec-Websocket-Key")
|
||||||
if challengeKey == "" {
|
if challengeKey == "" {
|
||||||
return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: `Sec-WebSocket-Key' header is missing or blank")
|
return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'Sec-WebSocket-Key' header is missing or blank")
|
||||||
}
|
}
|
||||||
|
|
||||||
subprotocol := u.selectSubprotocol(r, responseHeader)
|
subprotocol := u.selectSubprotocol(r, responseHeader)
|
||||||
|
|
132
vendor/github.com/gorilla/websocket/util.go
generated
vendored
132
vendor/github.com/gorilla/websocket/util.go
generated
vendored
|
@ -31,68 +31,113 @@ func generateChallengeKey() (string, error) {
|
||||||
return base64.StdEncoding.EncodeToString(p), nil
|
return base64.StdEncoding.EncodeToString(p), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Octet types from RFC 2616.
|
// Token octets per RFC 2616.
|
||||||
var octetTypes [256]byte
|
var isTokenOctet = [256]bool{
|
||||||
|
'!': true,
|
||||||
const (
|
'#': true,
|
||||||
isTokenOctet = 1 << iota
|
'$': true,
|
||||||
isSpaceOctet
|
'%': true,
|
||||||
)
|
'&': true,
|
||||||
|
'\'': true,
|
||||||
func init() {
|
'*': true,
|
||||||
// From RFC 2616
|
'+': true,
|
||||||
//
|
'-': true,
|
||||||
// OCTET = <any 8-bit sequence of data>
|
'.': true,
|
||||||
// CHAR = <any US-ASCII character (octets 0 - 127)>
|
'0': true,
|
||||||
// CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
|
'1': true,
|
||||||
// CR = <US-ASCII CR, carriage return (13)>
|
'2': true,
|
||||||
// LF = <US-ASCII LF, linefeed (10)>
|
'3': true,
|
||||||
// SP = <US-ASCII SP, space (32)>
|
'4': true,
|
||||||
// HT = <US-ASCII HT, horizontal-tab (9)>
|
'5': true,
|
||||||
// <"> = <US-ASCII double-quote mark (34)>
|
'6': true,
|
||||||
// CRLF = CR LF
|
'7': true,
|
||||||
// LWS = [CRLF] 1*( SP | HT )
|
'8': true,
|
||||||
// TEXT = <any OCTET except CTLs, but including LWS>
|
'9': true,
|
||||||
// separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <">
|
'A': true,
|
||||||
// | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT
|
'B': true,
|
||||||
// token = 1*<any CHAR except CTLs or separators>
|
'C': true,
|
||||||
// qdtext = <any TEXT except <">>
|
'D': true,
|
||||||
|
'E': true,
|
||||||
for c := 0; c < 256; c++ {
|
'F': true,
|
||||||
var t byte
|
'G': true,
|
||||||
isCtl := c <= 31 || c == 127
|
'H': true,
|
||||||
isChar := 0 <= c && c <= 127
|
'I': true,
|
||||||
isSeparator := strings.IndexRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) >= 0
|
'J': true,
|
||||||
if strings.IndexRune(" \t\r\n", rune(c)) >= 0 {
|
'K': true,
|
||||||
t |= isSpaceOctet
|
'L': true,
|
||||||
}
|
'M': true,
|
||||||
if isChar && !isCtl && !isSeparator {
|
'N': true,
|
||||||
t |= isTokenOctet
|
'O': true,
|
||||||
}
|
'P': true,
|
||||||
octetTypes[c] = t
|
'Q': true,
|
||||||
}
|
'R': true,
|
||||||
|
'S': true,
|
||||||
|
'T': true,
|
||||||
|
'U': true,
|
||||||
|
'W': true,
|
||||||
|
'V': true,
|
||||||
|
'X': true,
|
||||||
|
'Y': true,
|
||||||
|
'Z': true,
|
||||||
|
'^': true,
|
||||||
|
'_': true,
|
||||||
|
'`': true,
|
||||||
|
'a': true,
|
||||||
|
'b': true,
|
||||||
|
'c': true,
|
||||||
|
'd': true,
|
||||||
|
'e': true,
|
||||||
|
'f': true,
|
||||||
|
'g': true,
|
||||||
|
'h': true,
|
||||||
|
'i': true,
|
||||||
|
'j': true,
|
||||||
|
'k': true,
|
||||||
|
'l': true,
|
||||||
|
'm': true,
|
||||||
|
'n': true,
|
||||||
|
'o': true,
|
||||||
|
'p': true,
|
||||||
|
'q': true,
|
||||||
|
'r': true,
|
||||||
|
's': true,
|
||||||
|
't': true,
|
||||||
|
'u': true,
|
||||||
|
'v': true,
|
||||||
|
'w': true,
|
||||||
|
'x': true,
|
||||||
|
'y': true,
|
||||||
|
'z': true,
|
||||||
|
'|': true,
|
||||||
|
'~': true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skipSpace returns a slice of the string s with all leading RFC 2616 linear
|
||||||
|
// whitespace removed.
|
||||||
func skipSpace(s string) (rest string) {
|
func skipSpace(s string) (rest string) {
|
||||||
i := 0
|
i := 0
|
||||||
for ; i < len(s); i++ {
|
for ; i < len(s); i++ {
|
||||||
if octetTypes[s[i]]&isSpaceOctet == 0 {
|
if b := s[i]; b != ' ' && b != '\t' {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s[i:]
|
return s[i:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nextToken returns the leading RFC 2616 token of s and the string following
|
||||||
|
// the token.
|
||||||
func nextToken(s string) (token, rest string) {
|
func nextToken(s string) (token, rest string) {
|
||||||
i := 0
|
i := 0
|
||||||
for ; i < len(s); i++ {
|
for ; i < len(s); i++ {
|
||||||
if octetTypes[s[i]]&isTokenOctet == 0 {
|
if !isTokenOctet[s[i]] {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s[:i], s[i:]
|
return s[:i], s[i:]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nextTokenOrQuoted returns the leading token or quoted string per RFC 2616
|
||||||
|
// and the string following the token or quoted string.
|
||||||
func nextTokenOrQuoted(s string) (value string, rest string) {
|
func nextTokenOrQuoted(s string) (value string, rest string) {
|
||||||
if !strings.HasPrefix(s, "\"") {
|
if !strings.HasPrefix(s, "\"") {
|
||||||
return nextToken(s)
|
return nextToken(s)
|
||||||
|
@ -128,7 +173,8 @@ func nextTokenOrQuoted(s string) (value string, rest string) {
|
||||||
return "", ""
|
return "", ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// equalASCIIFold returns true if s is equal to t with ASCII case folding.
|
// equalASCIIFold returns true if s is equal to t with ASCII case folding as
|
||||||
|
// defined in RFC 4790.
|
||||||
func equalASCIIFold(s, t string) bool {
|
func equalASCIIFold(s, t string) bool {
|
||||||
for s != "" && t != "" {
|
for s != "" && t != "" {
|
||||||
sr, size := utf8.DecodeRuneInString(s)
|
sr, size := utf8.DecodeRuneInString(s)
|
||||||
|
|
2
vendor/github.com/mattn/go-colorable/go.mod
generated
vendored
2
vendor/github.com/mattn/go-colorable/go.mod
generated
vendored
|
@ -1,3 +1,3 @@
|
||||||
module github.com/mattn/go-colorable
|
module github.com/mattn/go-colorable
|
||||||
|
|
||||||
require github.com/mattn/go-isatty v0.0.5
|
require github.com/mattn/go-isatty v0.0.8
|
||||||
|
|
2
vendor/github.com/mattn/go-isatty/go.mod
generated
vendored
2
vendor/github.com/mattn/go-isatty/go.mod
generated
vendored
|
@ -1,3 +1,3 @@
|
||||||
module github.com/mattn/go-isatty
|
module github.com/mattn/go-isatty
|
||||||
|
|
||||||
require golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
|
require golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a
|
||||||
|
|
4
vendor/github.com/mattn/go-isatty/go.sum
generated
vendored
4
vendor/github.com/mattn/go-isatty/go.sum
generated
vendored
|
@ -1,2 +1,2 @@
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
|
2
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
2
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
|
@ -1,4 +1,4 @@
|
||||||
// +build appengine js
|
// +build appengine js nacl
|
||||||
|
|
||||||
package isatty
|
package isatty
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build linux
|
// +build linux aix
|
||||||
// +build !appengine
|
// +build !appengine
|
||||||
// +build !android
|
// +build !android
|
||||||
|
|
7
vendor/github.com/miekg/dns/.travis.yml
generated
vendored
7
vendor/github.com/miekg/dns/.travis.yml
generated
vendored
|
@ -2,15 +2,12 @@ language: go
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
go:
|
go:
|
||||||
- 1.10.x
|
|
||||||
- 1.11.x
|
- 1.11.x
|
||||||
- 1.12.x
|
- 1.12.x
|
||||||
- tip
|
- tip
|
||||||
|
|
||||||
before_install:
|
env:
|
||||||
# don't use the miekg/dns when testing forks
|
- GO111MODULE=on
|
||||||
- mkdir -p $GOPATH/src/github.com/miekg
|
|
||||||
- ln -s $TRAVIS_BUILD_DIR $GOPATH/src/github.com/miekg/ || true
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./...
|
- go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./...
|
||||||
|
|
57
vendor/github.com/miekg/dns/Gopkg.lock
generated
vendored
57
vendor/github.com/miekg/dns/Gopkg.lock
generated
vendored
|
@ -1,57 +0,0 @@
|
||||||
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
|
||||||
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:6914c49eed986dfb8dffb33516fa129c49929d4d873f41e073c83c11c372b870"
|
|
||||||
name = "golang.org/x/crypto"
|
|
||||||
packages = [
|
|
||||||
"ed25519",
|
|
||||||
"ed25519/internal/edwards25519",
|
|
||||||
]
|
|
||||||
pruneopts = ""
|
|
||||||
revision = "e3636079e1a4c1f337f212cc5cd2aca108f6c900"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:08e41d63f8dac84d83797368b56cf0b339e42d0224e5e56668963c28aec95685"
|
|
||||||
name = "golang.org/x/net"
|
|
||||||
packages = [
|
|
||||||
"bpf",
|
|
||||||
"context",
|
|
||||||
"internal/iana",
|
|
||||||
"internal/socket",
|
|
||||||
"ipv4",
|
|
||||||
"ipv6",
|
|
||||||
]
|
|
||||||
pruneopts = ""
|
|
||||||
revision = "4dfa2610cdf3b287375bbba5b8f2a14d3b01d8de"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:b2ea75de0ccb2db2ac79356407f8a4cd8f798fe15d41b381c00abf3ae8e55ed1"
|
|
||||||
name = "golang.org/x/sync"
|
|
||||||
packages = ["errgroup"]
|
|
||||||
pruneopts = ""
|
|
||||||
revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca"
|
|
||||||
|
|
||||||
[[projects]]
|
|
||||||
branch = "master"
|
|
||||||
digest = "1:149a432fabebb8221a80f77731b1cd63597197ded4f14af606ebe3a0959004ec"
|
|
||||||
name = "golang.org/x/sys"
|
|
||||||
packages = ["unix"]
|
|
||||||
pruneopts = ""
|
|
||||||
revision = "e4b3c5e9061176387e7cea65e4dc5853801f3fb7"
|
|
||||||
|
|
||||||
[solve-meta]
|
|
||||||
analyzer-name = "dep"
|
|
||||||
analyzer-version = 1
|
|
||||||
input-imports = [
|
|
||||||
"golang.org/x/crypto/ed25519",
|
|
||||||
"golang.org/x/net/ipv4",
|
|
||||||
"golang.org/x/net/ipv6",
|
|
||||||
"golang.org/x/sync/errgroup",
|
|
||||||
"golang.org/x/sys/unix",
|
|
||||||
]
|
|
||||||
solver-name = "gps-cdcl"
|
|
||||||
solver-version = 1
|
|
38
vendor/github.com/miekg/dns/Gopkg.toml
generated
vendored
38
vendor/github.com/miekg/dns/Gopkg.toml
generated
vendored
|
@ -1,38 +0,0 @@
|
||||||
|
|
||||||
# Gopkg.toml example
|
|
||||||
#
|
|
||||||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
|
||||||
# for detailed Gopkg.toml documentation.
|
|
||||||
#
|
|
||||||
# required = ["github.com/user/thing/cmd/thing"]
|
|
||||||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
|
||||||
#
|
|
||||||
# [[constraint]]
|
|
||||||
# name = "github.com/user/project"
|
|
||||||
# version = "1.0.0"
|
|
||||||
#
|
|
||||||
# [[constraint]]
|
|
||||||
# name = "github.com/user/project2"
|
|
||||||
# branch = "dev"
|
|
||||||
# source = "github.com/myfork/project2"
|
|
||||||
#
|
|
||||||
# [[override]]
|
|
||||||
# name = "github.com/x/y"
|
|
||||||
# version = "2.4.0"
|
|
||||||
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "golang.org/x/crypto"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "golang.org/x/net"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "golang.org/x/sys"
|
|
||||||
|
|
||||||
[[constraint]]
|
|
||||||
branch = "master"
|
|
||||||
name = "golang.org/x/sync"
|
|
2
vendor/github.com/miekg/dns/README.md
generated
vendored
2
vendor/github.com/miekg/dns/README.md
generated
vendored
|
@ -69,6 +69,7 @@ A not-so-up-to-date-list-that-may-be-actually-current:
|
||||||
* https://github.com/semihalev/sdns
|
* https://github.com/semihalev/sdns
|
||||||
* https://render.com
|
* https://render.com
|
||||||
* https://github.com/peterzen/goresolver
|
* https://github.com/peterzen/goresolver
|
||||||
|
* https://github.com/folbricht/routedns
|
||||||
|
|
||||||
Send pull request if you want to be listed here.
|
Send pull request if you want to be listed here.
|
||||||
|
|
||||||
|
@ -152,6 +153,7 @@ Example programs can be found in the `github.com/miekg/exdns` repository.
|
||||||
* 6844 - CAA record
|
* 6844 - CAA record
|
||||||
* 6891 - EDNS0 update
|
* 6891 - EDNS0 update
|
||||||
* 6895 - DNS IANA considerations
|
* 6895 - DNS IANA considerations
|
||||||
|
* 6944 - DNSSEC DNSKEY Algorithm Status
|
||||||
* 6975 - Algorithm Understanding in DNSSEC
|
* 6975 - Algorithm Understanding in DNSSEC
|
||||||
* 7043 - EUI48/EUI64 records
|
* 7043 - EUI48/EUI64 records
|
||||||
* 7314 - DNS (EDNS) EXPIRE Option
|
* 7314 - DNS (EDNS) EXPIRE Option
|
||||||
|
|
6
vendor/github.com/miekg/dns/acceptfunc.go
generated
vendored
6
vendor/github.com/miekg/dns/acceptfunc.go
generated
vendored
|
@ -22,6 +22,7 @@ const (
|
||||||
MsgAccept MsgAcceptAction = iota // Accept the message
|
MsgAccept MsgAcceptAction = iota // Accept the message
|
||||||
MsgReject // Reject the message with a RcodeFormatError
|
MsgReject // Reject the message with a RcodeFormatError
|
||||||
MsgIgnore // Ignore the error and send nothing back.
|
MsgIgnore // Ignore the error and send nothing back.
|
||||||
|
MsgRejectNotImplemented // Reject the message with a RcodeNotImplemented
|
||||||
)
|
)
|
||||||
|
|
||||||
func defaultMsgAcceptFunc(dh Header) MsgAcceptAction {
|
func defaultMsgAcceptFunc(dh Header) MsgAcceptAction {
|
||||||
|
@ -32,12 +33,9 @@ func defaultMsgAcceptFunc(dh Header) MsgAcceptAction {
|
||||||
// Don't allow dynamic updates, because then the sections can contain a whole bunch of RRs.
|
// Don't allow dynamic updates, because then the sections can contain a whole bunch of RRs.
|
||||||
opcode := int(dh.Bits>>11) & 0xF
|
opcode := int(dh.Bits>>11) & 0xF
|
||||||
if opcode != OpcodeQuery && opcode != OpcodeNotify {
|
if opcode != OpcodeQuery && opcode != OpcodeNotify {
|
||||||
return MsgReject
|
return MsgRejectNotImplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
if isZero := dh.Bits&_Z != 0; isZero {
|
|
||||||
return MsgReject
|
|
||||||
}
|
|
||||||
if dh.Qdcount != 1 {
|
if dh.Qdcount != 1 {
|
||||||
return MsgReject
|
return MsgReject
|
||||||
}
|
}
|
||||||
|
|
40
vendor/github.com/miekg/dns/client.go
generated
vendored
40
vendor/github.com/miekg/dns/client.go
generated
vendored
|
@ -215,8 +215,15 @@ func (co *Conn) ReadMsgHeader(hdr *Header) ([]byte, error) {
|
||||||
n int
|
n int
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
switch co.Conn.(type) {
|
|
||||||
case *net.TCPConn, *tls.Conn:
|
if _, ok := co.Conn.(net.PacketConn); ok {
|
||||||
|
if co.UDPSize > MinMsgSize {
|
||||||
|
p = make([]byte, co.UDPSize)
|
||||||
|
} else {
|
||||||
|
p = make([]byte, MinMsgSize)
|
||||||
|
}
|
||||||
|
n, err = co.Read(p)
|
||||||
|
} else {
|
||||||
var length uint16
|
var length uint16
|
||||||
if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil {
|
if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -224,13 +231,6 @@ func (co *Conn) ReadMsgHeader(hdr *Header) ([]byte, error) {
|
||||||
|
|
||||||
p = make([]byte, length)
|
p = make([]byte, length)
|
||||||
n, err = io.ReadFull(co.Conn, p)
|
n, err = io.ReadFull(co.Conn, p)
|
||||||
default:
|
|
||||||
if co.UDPSize > MinMsgSize {
|
|
||||||
p = make([]byte, co.UDPSize)
|
|
||||||
} else {
|
|
||||||
p = make([]byte, MinMsgSize)
|
|
||||||
}
|
|
||||||
n, err = co.Read(p)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -256,8 +256,11 @@ func (co *Conn) Read(p []byte) (n int, err error) {
|
||||||
return 0, ErrConnEmpty
|
return 0, ErrConnEmpty
|
||||||
}
|
}
|
||||||
|
|
||||||
switch co.Conn.(type) {
|
if _, ok := co.Conn.(net.PacketConn); ok {
|
||||||
case *net.TCPConn, *tls.Conn:
|
// UDP connection
|
||||||
|
return co.Conn.Read(p)
|
||||||
|
}
|
||||||
|
|
||||||
var length uint16
|
var length uint16
|
||||||
if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil {
|
if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
@ -269,10 +272,6 @@ func (co *Conn) Read(p []byte) (n int, err error) {
|
||||||
return io.ReadFull(co.Conn, p[:length])
|
return io.ReadFull(co.Conn, p[:length])
|
||||||
}
|
}
|
||||||
|
|
||||||
// UDP connection
|
|
||||||
return co.Conn.Read(p)
|
|
||||||
}
|
|
||||||
|
|
||||||
// WriteMsg sends a message through the connection co.
|
// WriteMsg sends a message through the connection co.
|
||||||
// If the message m contains a TSIG record the transaction
|
// If the message m contains a TSIG record the transaction
|
||||||
// signature is calculated.
|
// signature is calculated.
|
||||||
|
@ -297,13 +296,15 @@ func (co *Conn) WriteMsg(m *Msg) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write implements the net.Conn Write method.
|
// Write implements the net.Conn Write method.
|
||||||
func (co *Conn) Write(p []byte) (n int, err error) {
|
func (co *Conn) Write(p []byte) (int, error) {
|
||||||
switch co.Conn.(type) {
|
|
||||||
case *net.TCPConn, *tls.Conn:
|
|
||||||
if len(p) > MaxMsgSize {
|
if len(p) > MaxMsgSize {
|
||||||
return 0, &Error{err: "message too large"}
|
return 0, &Error{err: "message too large"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, ok := co.Conn.(net.PacketConn); ok {
|
||||||
|
return co.Conn.Write(p)
|
||||||
|
}
|
||||||
|
|
||||||
l := make([]byte, 2)
|
l := make([]byte, 2)
|
||||||
binary.BigEndian.PutUint16(l, uint16(len(p)))
|
binary.BigEndian.PutUint16(l, uint16(len(p)))
|
||||||
|
|
||||||
|
@ -311,9 +312,6 @@ func (co *Conn) Write(p []byte) (n int, err error) {
|
||||||
return int(n), err
|
return int(n), err
|
||||||
}
|
}
|
||||||
|
|
||||||
return co.Conn.Write(p)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the appropriate timeout for a specific request
|
// Return the appropriate timeout for a specific request
|
||||||
func (c *Client) getTimeoutForRequest(timeout time.Duration) time.Duration {
|
func (c *Client) getTimeoutForRequest(timeout time.Duration) time.Duration {
|
||||||
var requestTimeout time.Duration
|
var requestTimeout time.Duration
|
||||||
|
|
4
vendor/github.com/miekg/dns/dns.go
generated
vendored
4
vendor/github.com/miekg/dns/dns.go
generated
vendored
|
@ -54,7 +54,7 @@ type RR interface {
|
||||||
// parse parses an RR from zone file format.
|
// parse parses an RR from zone file format.
|
||||||
//
|
//
|
||||||
// This will only be called on a new and empty RR type with only the header populated.
|
// This will only be called on a new and empty RR type with only the header populated.
|
||||||
parse(c *zlexer, origin, file string) *ParseError
|
parse(c *zlexer, origin string) *ParseError
|
||||||
|
|
||||||
// isDuplicate returns whether the two RRs are duplicates.
|
// isDuplicate returns whether the two RRs are duplicates.
|
||||||
isDuplicate(r2 RR) bool
|
isDuplicate(r2 RR) bool
|
||||||
|
@ -105,7 +105,7 @@ func (h *RR_Header) unpack(msg []byte, off int) (int, error) {
|
||||||
panic("dns: internal error: unpack should never be called on RR_Header")
|
panic("dns: internal error: unpack should never be called on RR_Header")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *RR_Header) parse(c *zlexer, origin, file string) *ParseError {
|
func (h *RR_Header) parse(c *zlexer, origin string) *ParseError {
|
||||||
panic("dns: internal error: parse should never be called on RR_Header")
|
panic("dns: internal error: parse should never be called on RR_Header")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
vendor/github.com/miekg/dns/dnssec.go
generated
vendored
7
vendor/github.com/miekg/dns/dnssec.go
generated
vendored
|
@ -141,8 +141,8 @@ func (k *DNSKEY) KeyTag() uint16 {
|
||||||
switch k.Algorithm {
|
switch k.Algorithm {
|
||||||
case RSAMD5:
|
case RSAMD5:
|
||||||
// Look at the bottom two bytes of the modules, which the last
|
// Look at the bottom two bytes of the modules, which the last
|
||||||
// item in the pubkey. We could do this faster by looking directly
|
// item in the pubkey.
|
||||||
// at the base64 values. But I'm lazy.
|
// This algorithm has been deprecated, but keep this key-tag calculation.
|
||||||
modulus, _ := fromBase64([]byte(k.PublicKey))
|
modulus, _ := fromBase64([]byte(k.PublicKey))
|
||||||
if len(modulus) > 1 {
|
if len(modulus) > 1 {
|
||||||
x := binary.BigEndian.Uint16(modulus[len(modulus)-2:])
|
x := binary.BigEndian.Uint16(modulus[len(modulus)-2:])
|
||||||
|
@ -318,6 +318,9 @@ func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
rr.Signature = toBase64(signature)
|
rr.Signature = toBase64(signature)
|
||||||
|
case RSAMD5, DSA, DSANSEC3SHA1:
|
||||||
|
// See RFC 6944.
|
||||||
|
return ErrAlg
|
||||||
default:
|
default:
|
||||||
h := hash.New()
|
h := hash.New()
|
||||||
h.Write(signdata)
|
h.Write(signdata)
|
||||||
|
|
46
vendor/github.com/miekg/dns/dnssec_keygen.go
generated
vendored
46
vendor/github.com/miekg/dns/dnssec_keygen.go
generated
vendored
|
@ -2,7 +2,6 @@ package dns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto"
|
"crypto"
|
||||||
"crypto/dsa"
|
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"crypto/elliptic"
|
"crypto/elliptic"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
@ -20,11 +19,9 @@ import (
|
||||||
// bits should be set to the size of the algorithm.
|
// bits should be set to the size of the algorithm.
|
||||||
func (k *DNSKEY) Generate(bits int) (crypto.PrivateKey, error) {
|
func (k *DNSKEY) Generate(bits int) (crypto.PrivateKey, error) {
|
||||||
switch k.Algorithm {
|
switch k.Algorithm {
|
||||||
case DSA, DSANSEC3SHA1:
|
case RSAMD5, DSA, DSANSEC3SHA1:
|
||||||
if bits != 1024 {
|
return nil, ErrAlg
|
||||||
return nil, ErrKeySize
|
case RSASHA1, RSASHA256, RSASHA1NSEC3SHA1:
|
||||||
}
|
|
||||||
case RSAMD5, RSASHA1, RSASHA256, RSASHA1NSEC3SHA1:
|
|
||||||
if bits < 512 || bits > 4096 {
|
if bits < 512 || bits > 4096 {
|
||||||
return nil, ErrKeySize
|
return nil, ErrKeySize
|
||||||
}
|
}
|
||||||
|
@ -47,20 +44,7 @@ func (k *DNSKEY) Generate(bits int) (crypto.PrivateKey, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch k.Algorithm {
|
switch k.Algorithm {
|
||||||
case DSA, DSANSEC3SHA1:
|
case RSASHA1, RSASHA256, RSASHA512, RSASHA1NSEC3SHA1:
|
||||||
params := new(dsa.Parameters)
|
|
||||||
if err := dsa.GenerateParameters(params, rand.Reader, dsa.L1024N160); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
priv := new(dsa.PrivateKey)
|
|
||||||
priv.PublicKey.Parameters = *params
|
|
||||||
err := dsa.GenerateKey(priv, rand.Reader)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
k.setPublicKeyDSA(params.Q, params.P, params.G, priv.PublicKey.Y)
|
|
||||||
return priv, nil
|
|
||||||
case RSAMD5, RSASHA1, RSASHA256, RSASHA512, RSASHA1NSEC3SHA1:
|
|
||||||
priv, err := rsa.GenerateKey(rand.Reader, bits)
|
priv, err := rsa.GenerateKey(rand.Reader, bits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -120,16 +104,6 @@ func (k *DNSKEY) setPublicKeyECDSA(_X, _Y *big.Int) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the public key for DSA
|
|
||||||
func (k *DNSKEY) setPublicKeyDSA(_Q, _P, _G, _Y *big.Int) bool {
|
|
||||||
if _Q == nil || _P == nil || _G == nil || _Y == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
buf := dsaToBuf(_Q, _P, _G, _Y)
|
|
||||||
k.PublicKey = toBase64(buf)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the public key for Ed25519
|
// Set the public key for Ed25519
|
||||||
func (k *DNSKEY) setPublicKeyED25519(_K ed25519.PublicKey) bool {
|
func (k *DNSKEY) setPublicKeyED25519(_K ed25519.PublicKey) bool {
|
||||||
if _K == nil {
|
if _K == nil {
|
||||||
|
@ -164,15 +138,3 @@ func curveToBuf(_X, _Y *big.Int, intlen int) []byte {
|
||||||
buf = append(buf, intToBytes(_Y, intlen)...)
|
buf = append(buf, intToBytes(_Y, intlen)...)
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the public key for X and Y for Curve. The two
|
|
||||||
// values are just concatenated.
|
|
||||||
func dsaToBuf(_Q, _P, _G, _Y *big.Int) []byte {
|
|
||||||
t := divRoundUp(divRoundUp(_G.BitLen(), 8)-64, 8)
|
|
||||||
buf := []byte{byte(t)}
|
|
||||||
buf = append(buf, intToBytes(_Q, 20)...)
|
|
||||||
buf = append(buf, intToBytes(_P, 64+t*8)...)
|
|
||||||
buf = append(buf, intToBytes(_G, 64+t*8)...)
|
|
||||||
buf = append(buf, intToBytes(_Y, 64+t*8)...)
|
|
||||||
return buf
|
|
||||||
}
|
|
||||||
|
|
34
vendor/github.com/miekg/dns/dnssec_keyscan.go
generated
vendored
34
vendor/github.com/miekg/dns/dnssec_keyscan.go
generated
vendored
|
@ -3,7 +3,6 @@ package dns
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"crypto"
|
"crypto"
|
||||||
"crypto/dsa"
|
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"io"
|
"io"
|
||||||
|
@ -44,19 +43,8 @@ func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (crypto.PrivateKey, er
|
||||||
return nil, ErrPrivKey
|
return nil, ErrPrivKey
|
||||||
}
|
}
|
||||||
switch uint8(algo) {
|
switch uint8(algo) {
|
||||||
case DSA:
|
case RSAMD5, DSA, DSANSEC3SHA1:
|
||||||
priv, err := readPrivateKeyDSA(m)
|
return nil, ErrAlg
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
pub := k.publicKeyDSA()
|
|
||||||
if pub == nil {
|
|
||||||
return nil, ErrKey
|
|
||||||
}
|
|
||||||
priv.PublicKey = *pub
|
|
||||||
return priv, nil
|
|
||||||
case RSAMD5:
|
|
||||||
fallthrough
|
|
||||||
case RSASHA1:
|
case RSASHA1:
|
||||||
fallthrough
|
fallthrough
|
||||||
case RSASHA1NSEC3SHA1:
|
case RSASHA1NSEC3SHA1:
|
||||||
|
@ -129,24 +117,6 @@ func readPrivateKeyRSA(m map[string]string) (*rsa.PrivateKey, error) {
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func readPrivateKeyDSA(m map[string]string) (*dsa.PrivateKey, error) {
|
|
||||||
p := new(dsa.PrivateKey)
|
|
||||||
p.X = new(big.Int)
|
|
||||||
for k, v := range m {
|
|
||||||
switch k {
|
|
||||||
case "private_value(x)":
|
|
||||||
v1, err := fromBase64([]byte(v))
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
p.X.SetBytes(v1)
|
|
||||||
case "created", "publish", "activate":
|
|
||||||
/* not used in Go (yet) */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return p, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func readPrivateKeyECDSA(m map[string]string) (*ecdsa.PrivateKey, error) {
|
func readPrivateKeyECDSA(m map[string]string) (*ecdsa.PrivateKey, error) {
|
||||||
p := new(ecdsa.PrivateKey)
|
p := new(ecdsa.PrivateKey)
|
||||||
p.D = new(big.Int)
|
p.D = new(big.Int)
|
||||||
|
|
2
vendor/github.com/miekg/dns/edns.go
generated
vendored
2
vendor/github.com/miekg/dns/edns.go
generated
vendored
|
@ -88,7 +88,7 @@ func (rr *OPT) len(off int, compression map[string]struct{}) int {
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *OPT) parse(c *zlexer, origin, file string) *ParseError {
|
func (rr *OPT) parse(c *zlexer, origin string) *ParseError {
|
||||||
panic("dns: internal error: parse should never be called on OPT")
|
panic("dns: internal error: parse should never be called on OPT")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
vendor/github.com/miekg/dns/go.mod
generated
vendored
Normal file
10
vendor/github.com/miekg/dns/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
module github.com/miekg/dns
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4
|
||||||
|
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
|
||||||
|
golang.org/x/sys v0.0.0-20180928133829-e4b3c5e90611
|
||||||
|
)
|
8
vendor/github.com/miekg/dns/go.sum
generated
vendored
Normal file
8
vendor/github.com/miekg/dns/go.sum
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4 h1:Vk3wNqEZwyGyei9yq5ekj7frek2u7HUfffJ1/opblzc=
|
||||||
|
golang.org/x/crypto v0.0.0-20181001203147-e3636079e1a4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||||
|
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3 h1:dgd4x4kJt7G4k4m93AYLzM8Ni6h2qLTfh9n9vXJT3/0=
|
||||||
|
golang.org/x/net v0.0.0-20180926154720-4dfa2610cdf3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
|
||||||
|
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20180928133829-e4b3c5e90611 h1:O33LKL7WyJgjN9CvxfTIomjIClbd/Kq86/iipowHQU0=
|
||||||
|
golang.org/x/sys v0.0.0-20180928133829-e4b3c5e90611/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
25
vendor/github.com/miekg/dns/msg_helpers.go
generated
vendored
25
vendor/github.com/miekg/dns/msg_helpers.go
generated
vendored
|
@ -495,7 +495,7 @@ Option:
|
||||||
func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) {
|
func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) {
|
||||||
for _, el := range options {
|
for _, el := range options {
|
||||||
b, err := el.pack()
|
b, err := el.pack()
|
||||||
if err != nil || off+3 > len(msg) {
|
if err != nil || off+4 > len(msg) {
|
||||||
return len(msg), &Error{err: "overflow packing opt"}
|
return len(msg), &Error{err: "overflow packing opt"}
|
||||||
}
|
}
|
||||||
binary.BigEndian.PutUint16(msg[off:], el.Option()) // Option code
|
binary.BigEndian.PutUint16(msg[off:], el.Option()) // Option code
|
||||||
|
@ -587,6 +587,29 @@ func unpackDataNsec(msg []byte, off int) ([]uint16, int, error) {
|
||||||
return nsec, off, nil
|
return nsec, off, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// typeBitMapLen is a helper function which computes the "maximum" length of
|
||||||
|
// a the NSEC Type BitMap field.
|
||||||
|
func typeBitMapLen(bitmap []uint16) int {
|
||||||
|
var l int
|
||||||
|
var lastwindow, lastlength uint16
|
||||||
|
for _, t := range bitmap {
|
||||||
|
window := t / 256
|
||||||
|
length := (t-window*256)/8 + 1
|
||||||
|
if window > lastwindow && lastlength != 0 { // New window, jump to the new offset
|
||||||
|
l += int(lastlength) + 2
|
||||||
|
lastlength = 0
|
||||||
|
}
|
||||||
|
if window < lastwindow || length < lastlength {
|
||||||
|
// packDataNsec would return Error{err: "nsec bits out of order"} here, but
|
||||||
|
// when computing the length, we want do be liberal.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
lastwindow, lastlength = window, length
|
||||||
|
}
|
||||||
|
l += int(lastlength) + 2
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
func packDataNsec(bitmap []uint16, msg []byte, off int) (int, error) {
|
func packDataNsec(bitmap []uint16, msg []byte, off int) (int, error) {
|
||||||
if len(bitmap) == 0 {
|
if len(bitmap) == 0 {
|
||||||
return off, nil
|
return off, nil
|
||||||
|
|
17
vendor/github.com/miekg/dns/msg_truncate.go
generated
vendored
17
vendor/github.com/miekg/dns/msg_truncate.go
generated
vendored
|
@ -4,12 +4,17 @@ package dns
|
||||||
// size by removing records that exceed the requested size.
|
// size by removing records that exceed the requested size.
|
||||||
//
|
//
|
||||||
// It will first check if the reply fits without compression and then with
|
// It will first check if the reply fits without compression and then with
|
||||||
// compression. If it won't fit with compression, Scrub then walks the
|
// compression. If it won't fit with compression, Truncate then walks the
|
||||||
// record adding as many records as possible without exceeding the
|
// record adding as many records as possible without exceeding the
|
||||||
// requested buffer size.
|
// requested buffer size.
|
||||||
//
|
//
|
||||||
// The TC bit will be set if any answer records were excluded from the
|
// The TC bit will be set if any records were excluded from the message.
|
||||||
// message. This indicates to that the client should retry over TCP.
|
// This indicates to that the client should retry over TCP.
|
||||||
|
//
|
||||||
|
// According to RFC 2181, the TC bit should only be set if not all of the
|
||||||
|
// "required" RRs can be included in the response. Unfortunately, we have
|
||||||
|
// no way of knowing which RRs are required so we set the TC bit if any RR
|
||||||
|
// had to be omitted from the response.
|
||||||
//
|
//
|
||||||
// The appropriate buffer size can be retrieved from the requests OPT
|
// The appropriate buffer size can be retrieved from the requests OPT
|
||||||
// record, if present, and is transport specific otherwise. dns.MinMsgSize
|
// record, if present, and is transport specific otherwise. dns.MinMsgSize
|
||||||
|
@ -71,9 +76,9 @@ func (dns *Msg) Truncate(size int) {
|
||||||
l, numExtra = truncateLoop(dns.Extra, size, l, compression)
|
l, numExtra = truncateLoop(dns.Extra, size, l, compression)
|
||||||
}
|
}
|
||||||
|
|
||||||
// According to RFC 2181, the TC bit should only be set if not all
|
// See the function documentation for when we set this.
|
||||||
// of the answer RRs can be included in the response.
|
dns.Truncated = len(dns.Answer) > numAnswer ||
|
||||||
dns.Truncated = len(dns.Answer) > numAnswer
|
len(dns.Ns) > numNS || len(dns.Extra) > numExtra
|
||||||
|
|
||||||
dns.Answer = dns.Answer[:numAnswer]
|
dns.Answer = dns.Answer[:numAnswer]
|
||||||
dns.Ns = dns.Ns[:numNS]
|
dns.Ns = dns.Ns[:numNS]
|
||||||
|
|
38
vendor/github.com/miekg/dns/privaterr.go
generated
vendored
38
vendor/github.com/miekg/dns/privaterr.go
generated
vendored
|
@ -1,9 +1,6 @@
|
||||||
package dns
|
package dns
|
||||||
|
|
||||||
import (
|
import "strings"
|
||||||
"fmt"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// PrivateRdata is an interface used for implementing "Private Use" RR types, see
|
// PrivateRdata is an interface used for implementing "Private Use" RR types, see
|
||||||
// RFC 6895. This allows one to experiment with new RR types, without requesting an
|
// RFC 6895. This allows one to experiment with new RR types, without requesting an
|
||||||
|
@ -18,7 +15,7 @@ type PrivateRdata interface {
|
||||||
// Unpack is used when unpacking a private RR from a buffer.
|
// Unpack is used when unpacking a private RR from a buffer.
|
||||||
// TODO(miek): diff. signature than Pack, see edns0.go for instance.
|
// TODO(miek): diff. signature than Pack, see edns0.go for instance.
|
||||||
Unpack([]byte) (int, error)
|
Unpack([]byte) (int, error)
|
||||||
// Copy copies the Rdata.
|
// Copy copies the Rdata into the PrivateRdata argument.
|
||||||
Copy(PrivateRdata) error
|
Copy(PrivateRdata) error
|
||||||
// Len returns the length in octets of the Rdata.
|
// Len returns the length in octets of the Rdata.
|
||||||
Len() int
|
Len() int
|
||||||
|
@ -29,22 +26,8 @@ type PrivateRdata interface {
|
||||||
type PrivateRR struct {
|
type PrivateRR struct {
|
||||||
Hdr RR_Header
|
Hdr RR_Header
|
||||||
Data PrivateRdata
|
Data PrivateRdata
|
||||||
}
|
|
||||||
|
|
||||||
func mkPrivateRR(rrtype uint16) *PrivateRR {
|
generator func() PrivateRdata // for copy
|
||||||
// Panics if RR is not an instance of PrivateRR.
|
|
||||||
rrfunc, ok := TypeToRR[rrtype]
|
|
||||||
if !ok {
|
|
||||||
panic(fmt.Sprintf("dns: invalid operation with Private RR type %d", rrtype))
|
|
||||||
}
|
|
||||||
|
|
||||||
anyrr := rrfunc()
|
|
||||||
rr, ok := anyrr.(*PrivateRR)
|
|
||||||
if !ok {
|
|
||||||
panic(fmt.Sprintf("dns: RR is not a PrivateRR, TypeToRR[%d] generator returned %T", rrtype, anyrr))
|
|
||||||
}
|
|
||||||
|
|
||||||
return rr
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header return the RR header of r.
|
// Header return the RR header of r.
|
||||||
|
@ -61,13 +44,12 @@ func (r *PrivateRR) len(off int, compression map[string]struct{}) int {
|
||||||
|
|
||||||
func (r *PrivateRR) copy() RR {
|
func (r *PrivateRR) copy() RR {
|
||||||
// make new RR like this:
|
// make new RR like this:
|
||||||
rr := mkPrivateRR(r.Hdr.Rrtype)
|
rr := &PrivateRR{r.Hdr, r.generator(), r.generator}
|
||||||
rr.Hdr = r.Hdr
|
|
||||||
|
|
||||||
err := r.Data.Copy(rr.Data)
|
if err := r.Data.Copy(rr.Data); err != nil {
|
||||||
if err != nil {
|
panic("dns: got value that could not be used to copy Private rdata: " + err.Error())
|
||||||
panic("dns: got value that could not be used to copy Private rdata")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rr
|
return rr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +68,7 @@ func (r *PrivateRR) unpack(msg []byte, off int) (int, error) {
|
||||||
return off, err
|
return off, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *PrivateRR) parse(c *zlexer, origin, file string) *ParseError {
|
func (r *PrivateRR) parse(c *zlexer, origin string) *ParseError {
|
||||||
var l lex
|
var l lex
|
||||||
text := make([]string, 0, 2) // could be 0..N elements, median is probably 1
|
text := make([]string, 0, 2) // could be 0..N elements, median is probably 1
|
||||||
Fetch:
|
Fetch:
|
||||||
|
@ -103,7 +85,7 @@ Fetch:
|
||||||
|
|
||||||
err := r.Data.Parse(text)
|
err := r.Data.Parse(text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &ParseError{file, err.Error(), l}
|
return &ParseError{"", err.Error(), l}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -116,7 +98,7 @@ func (r1 *PrivateRR) isDuplicate(r2 RR) bool { return false }
|
||||||
func PrivateHandle(rtypestr string, rtype uint16, generator func() PrivateRdata) {
|
func PrivateHandle(rtypestr string, rtype uint16, generator func() PrivateRdata) {
|
||||||
rtypestr = strings.ToUpper(rtypestr)
|
rtypestr = strings.ToUpper(rtypestr)
|
||||||
|
|
||||||
TypeToRR[rtype] = func() RR { return &PrivateRR{RR_Header{}, generator()} }
|
TypeToRR[rtype] = func() RR { return &PrivateRR{RR_Header{}, generator(), generator} }
|
||||||
TypeToString[rtype] = rtypestr
|
TypeToString[rtype] = rtypestr
|
||||||
StringToType[rtypestr] = rtype
|
StringToType[rtypestr] = rtype
|
||||||
}
|
}
|
||||||
|
|
102
vendor/github.com/miekg/dns/scan.go
generated
vendored
102
vendor/github.com/miekg/dns/scan.go
generated
vendored
|
@ -503,9 +503,8 @@ func (zp *ZoneParser) Next() (RR, bool) {
|
||||||
return zp.setParseError("expecting $TTL value, not this...", l)
|
return zp.setParseError("expecting $TTL value, not this...", l)
|
||||||
}
|
}
|
||||||
|
|
||||||
if e := slurpRemainder(zp.c, zp.file); e != nil {
|
if err := slurpRemainder(zp.c); err != nil {
|
||||||
zp.parseErr = e
|
return zp.setParseError(err.err, err.lex)
|
||||||
return nil, false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ttl, ok := stringToTTL(l.token)
|
ttl, ok := stringToTTL(l.token)
|
||||||
|
@ -527,9 +526,8 @@ func (zp *ZoneParser) Next() (RR, bool) {
|
||||||
return zp.setParseError("expecting $ORIGIN value, not this...", l)
|
return zp.setParseError("expecting $ORIGIN value, not this...", l)
|
||||||
}
|
}
|
||||||
|
|
||||||
if e := slurpRemainder(zp.c, zp.file); e != nil {
|
if err := slurpRemainder(zp.c); err != nil {
|
||||||
zp.parseErr = e
|
return zp.setParseError(err.err, err.lex)
|
||||||
return nil, false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
name, ok := toAbsoluteName(l.token, zp.origin)
|
name, ok := toAbsoluteName(l.token, zp.origin)
|
||||||
|
@ -650,19 +648,44 @@ func (zp *ZoneParser) Next() (RR, bool) {
|
||||||
|
|
||||||
st = zExpectRdata
|
st = zExpectRdata
|
||||||
case zExpectRdata:
|
case zExpectRdata:
|
||||||
r, e := setRR(*h, zp.c, zp.origin, zp.file)
|
var rr RR
|
||||||
if e != nil {
|
if newFn, ok := TypeToRR[h.Rrtype]; ok && canParseAsRR(h.Rrtype) {
|
||||||
// If e.lex is nil than we have encounter a unknown RR type
|
rr = newFn()
|
||||||
// in that case we substitute our current lex token
|
*rr.Header() = *h
|
||||||
if e.lex.token == "" && e.lex.value == 0 {
|
} else {
|
||||||
e.lex = l // Uh, dirty
|
rr = &RFC3597{Hdr: *h}
|
||||||
}
|
}
|
||||||
|
|
||||||
zp.parseErr = e
|
_, isPrivate := rr.(*PrivateRR)
|
||||||
return nil, false
|
if !isPrivate && zp.c.Peek().token == "" {
|
||||||
|
// This is a dynamic update rr.
|
||||||
|
|
||||||
|
// TODO(tmthrgd): Previously slurpRemainder was only called
|
||||||
|
// for certain RR types, which may have been important.
|
||||||
|
if err := slurpRemainder(zp.c); err != nil {
|
||||||
|
return zp.setParseError(err.err, err.lex)
|
||||||
}
|
}
|
||||||
|
|
||||||
return r, true
|
return rr, true
|
||||||
|
} else if l.value == zNewline {
|
||||||
|
return zp.setParseError("unexpected newline", l)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := rr.parse(zp.c, zp.origin); err != nil {
|
||||||
|
// err is a concrete *ParseError without the file field set.
|
||||||
|
// The setParseError call below will construct a new
|
||||||
|
// *ParseError with file set to zp.file.
|
||||||
|
|
||||||
|
// If err.lex is nil than we have encounter an unknown RR type
|
||||||
|
// in that case we substitute our current lex token.
|
||||||
|
if err.lex == (lex{}) {
|
||||||
|
return zp.setParseError(err.err, l)
|
||||||
|
}
|
||||||
|
|
||||||
|
return zp.setParseError(err.err, err.lex)
|
||||||
|
}
|
||||||
|
|
||||||
|
return rr, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,6 +694,18 @@ func (zp *ZoneParser) Next() (RR, bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// canParseAsRR returns true if the record type can be parsed as a
|
||||||
|
// concrete RR. It blacklists certain record types that must be parsed
|
||||||
|
// according to RFC 3597 because they lack a presentation format.
|
||||||
|
func canParseAsRR(rrtype uint16) bool {
|
||||||
|
switch rrtype {
|
||||||
|
case TypeANY, TypeNULL, TypeOPT, TypeTSIG:
|
||||||
|
return false
|
||||||
|
default:
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type zlexer struct {
|
type zlexer struct {
|
||||||
br io.ByteReader
|
br io.ByteReader
|
||||||
|
|
||||||
|
@ -683,6 +718,7 @@ type zlexer struct {
|
||||||
comment string
|
comment string
|
||||||
|
|
||||||
l lex
|
l lex
|
||||||
|
cachedL *lex
|
||||||
|
|
||||||
brace int
|
brace int
|
||||||
quote bool
|
quote bool
|
||||||
|
@ -748,13 +784,37 @@ func (zl *zlexer) readByte() (byte, bool) {
|
||||||
return c, true
|
return c, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (zl *zlexer) Peek() lex {
|
||||||
|
if zl.nextL {
|
||||||
|
return zl.l
|
||||||
|
}
|
||||||
|
|
||||||
|
l, ok := zl.Next()
|
||||||
|
if !ok {
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
|
if zl.nextL {
|
||||||
|
// Cache l. Next returns zl.cachedL then zl.l.
|
||||||
|
zl.cachedL = &l
|
||||||
|
} else {
|
||||||
|
// In this case l == zl.l, so we just tell Next to return zl.l.
|
||||||
|
zl.nextL = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
func (zl *zlexer) Next() (lex, bool) {
|
func (zl *zlexer) Next() (lex, bool) {
|
||||||
l := &zl.l
|
l := &zl.l
|
||||||
if zl.nextL {
|
switch {
|
||||||
|
case zl.cachedL != nil:
|
||||||
|
l, zl.cachedL = zl.cachedL, nil
|
||||||
|
return *l, true
|
||||||
|
case zl.nextL:
|
||||||
zl.nextL = false
|
zl.nextL = false
|
||||||
return *l, true
|
return *l, true
|
||||||
}
|
case l.err:
|
||||||
if l.err {
|
|
||||||
// Parsing errors should be sticky.
|
// Parsing errors should be sticky.
|
||||||
return lex{value: zEOF}, false
|
return lex{value: zEOF}, false
|
||||||
}
|
}
|
||||||
|
@ -1302,18 +1362,18 @@ func locCheckEast(token string, longitude uint32) (uint32, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Eat" the rest of the "line"
|
// "Eat" the rest of the "line"
|
||||||
func slurpRemainder(c *zlexer, f string) *ParseError {
|
func slurpRemainder(c *zlexer) *ParseError {
|
||||||
l, _ := c.Next()
|
l, _ := c.Next()
|
||||||
switch l.value {
|
switch l.value {
|
||||||
case zBlank:
|
case zBlank:
|
||||||
l, _ = c.Next()
|
l, _ = c.Next()
|
||||||
if l.value != zNewline && l.value != zEOF {
|
if l.value != zNewline && l.value != zEOF {
|
||||||
return &ParseError{f, "garbage after rdata", l}
|
return &ParseError{"", "garbage after rdata", l}
|
||||||
}
|
}
|
||||||
case zNewline:
|
case zNewline:
|
||||||
case zEOF:
|
case zEOF:
|
||||||
default:
|
default:
|
||||||
return &ParseError{f, "garbage after rdata", l}
|
return &ParseError{"", "garbage after rdata", l}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
829
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
829
vendor/github.com/miekg/dns/scan_rr.go
generated
vendored
File diff suppressed because it is too large
Load diff
11
vendor/github.com/miekg/dns/server.go
generated
vendored
11
vendor/github.com/miekg/dns/server.go
generated
vendored
|
@ -560,15 +560,22 @@ func (srv *Server) serveDNS(m []byte, w *response) {
|
||||||
req := new(Msg)
|
req := new(Msg)
|
||||||
req.setHdr(dh)
|
req.setHdr(dh)
|
||||||
|
|
||||||
switch srv.MsgAcceptFunc(dh) {
|
switch action := srv.MsgAcceptFunc(dh); action {
|
||||||
case MsgAccept:
|
case MsgAccept:
|
||||||
if req.unpack(dh, m, off) == nil {
|
if req.unpack(dh, m, off) == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
fallthrough
|
fallthrough
|
||||||
case MsgReject:
|
case MsgReject, MsgRejectNotImplemented:
|
||||||
|
opcode := req.Opcode
|
||||||
req.SetRcodeFormatError(req)
|
req.SetRcodeFormatError(req)
|
||||||
|
req.Zero = false
|
||||||
|
if action == MsgRejectNotImplemented {
|
||||||
|
req.Opcode = opcode
|
||||||
|
req.Rcode = RcodeNotImplemented
|
||||||
|
}
|
||||||
|
|
||||||
// Are we allowed to delete any OPT records here?
|
// Are we allowed to delete any OPT records here?
|
||||||
req.Ns, req.Answer, req.Extra = nil, nil, nil
|
req.Ns, req.Answer, req.Extra = nil, nil, nil
|
||||||
|
|
||||||
|
|
2
vendor/github.com/miekg/dns/tsig.go
generated
vendored
2
vendor/github.com/miekg/dns/tsig.go
generated
vendored
|
@ -54,7 +54,7 @@ func (rr *TSIG) String() string {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *TSIG) parse(c *zlexer, origin, file string) *ParseError {
|
func (rr *TSIG) parse(c *zlexer, origin string) *ParseError {
|
||||||
panic("dns: internal error: parse should never be called on TSIG")
|
panic("dns: internal error: parse should never be called on TSIG")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
31
vendor/github.com/miekg/dns/types.go
generated
vendored
31
vendor/github.com/miekg/dns/types.go
generated
vendored
|
@ -238,7 +238,7 @@ type ANY struct {
|
||||||
|
|
||||||
func (rr *ANY) String() string { return rr.Hdr.String() }
|
func (rr *ANY) String() string { return rr.Hdr.String() }
|
||||||
|
|
||||||
func (rr *ANY) parse(c *zlexer, origin, file string) *ParseError {
|
func (rr *ANY) parse(c *zlexer, origin string) *ParseError {
|
||||||
panic("dns: internal error: parse should never be called on ANY")
|
panic("dns: internal error: parse should never be called on ANY")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ func (rr *NULL) String() string {
|
||||||
return ";" + rr.Hdr.String() + rr.Data
|
return ";" + rr.Hdr.String() + rr.Data
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rr *NULL) parse(c *zlexer, origin, file string) *ParseError {
|
func (rr *NULL) parse(c *zlexer, origin string) *ParseError {
|
||||||
panic("dns: internal error: parse should never be called on NULL")
|
panic("dns: internal error: parse should never be called on NULL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -854,14 +854,7 @@ func (rr *NSEC) String() string {
|
||||||
func (rr *NSEC) len(off int, compression map[string]struct{}) int {
|
func (rr *NSEC) len(off int, compression map[string]struct{}) int {
|
||||||
l := rr.Hdr.len(off, compression)
|
l := rr.Hdr.len(off, compression)
|
||||||
l += domainNameLen(rr.NextDomain, off+l, compression, false)
|
l += domainNameLen(rr.NextDomain, off+l, compression, false)
|
||||||
lastwindow := uint32(2 ^ 32 + 1)
|
l += typeBitMapLen(rr.TypeBitMap)
|
||||||
for _, t := range rr.TypeBitMap {
|
|
||||||
window := t / 256
|
|
||||||
if uint32(window) != lastwindow {
|
|
||||||
l += 1 + 32
|
|
||||||
}
|
|
||||||
lastwindow = uint32(window)
|
|
||||||
}
|
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1020,14 +1013,7 @@ func (rr *NSEC3) String() string {
|
||||||
func (rr *NSEC3) len(off int, compression map[string]struct{}) int {
|
func (rr *NSEC3) len(off int, compression map[string]struct{}) int {
|
||||||
l := rr.Hdr.len(off, compression)
|
l := rr.Hdr.len(off, compression)
|
||||||
l += 6 + len(rr.Salt)/2 + 1 + len(rr.NextDomain) + 1
|
l += 6 + len(rr.Salt)/2 + 1 + len(rr.NextDomain) + 1
|
||||||
lastwindow := uint32(2 ^ 32 + 1)
|
l += typeBitMapLen(rr.TypeBitMap)
|
||||||
for _, t := range rr.TypeBitMap {
|
|
||||||
window := t / 256
|
|
||||||
if uint32(window) != lastwindow {
|
|
||||||
l += 1 + 32
|
|
||||||
}
|
|
||||||
lastwindow = uint32(window)
|
|
||||||
}
|
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1344,14 +1330,7 @@ func (rr *CSYNC) String() string {
|
||||||
func (rr *CSYNC) len(off int, compression map[string]struct{}) int {
|
func (rr *CSYNC) len(off int, compression map[string]struct{}) int {
|
||||||
l := rr.Hdr.len(off, compression)
|
l := rr.Hdr.len(off, compression)
|
||||||
l += 4 + 2
|
l += 4 + 2
|
||||||
lastwindow := uint32(2 ^ 32 + 1)
|
l += typeBitMapLen(rr.TypeBitMap)
|
||||||
for _, t := range rr.TypeBitMap {
|
|
||||||
window := t / 256
|
|
||||||
if uint32(window) != lastwindow {
|
|
||||||
l += 1 + 32
|
|
||||||
}
|
|
||||||
lastwindow = uint32(window)
|
|
||||||
}
|
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
vendor/github.com/miekg/dns/types_generate.go
generated
vendored
4
vendor/github.com/miekg/dns/types_generate.go
generated
vendored
|
@ -189,10 +189,8 @@ func main() {
|
||||||
o("l += base64.StdEncoding.DecodedLen(len(rr.%s))\n")
|
o("l += base64.StdEncoding.DecodedLen(len(rr.%s))\n")
|
||||||
case strings.HasPrefix(st.Tag(i), `dns:"size-hex:`): // this has an extra field where the length is stored
|
case strings.HasPrefix(st.Tag(i), `dns:"size-hex:`): // this has an extra field where the length is stored
|
||||||
o("l += len(rr.%s)/2\n")
|
o("l += len(rr.%s)/2\n")
|
||||||
case strings.HasPrefix(st.Tag(i), `dns:"size-hex`):
|
|
||||||
fallthrough
|
|
||||||
case st.Tag(i) == `dns:"hex"`:
|
case st.Tag(i) == `dns:"hex"`:
|
||||||
o("l += len(rr.%s)/2 + 1\n")
|
o("l += len(rr.%s)/2\n")
|
||||||
case st.Tag(i) == `dns:"any"`:
|
case st.Tag(i) == `dns:"any"`:
|
||||||
o("l += len(rr.%s)\n")
|
o("l += len(rr.%s)\n")
|
||||||
case st.Tag(i) == `dns:"a"`:
|
case st.Tag(i) == `dns:"a"`:
|
||||||
|
|
2
vendor/github.com/miekg/dns/version.go
generated
vendored
2
vendor/github.com/miekg/dns/version.go
generated
vendored
|
@ -3,7 +3,7 @@ package dns
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
// Version is current version of this library.
|
// Version is current version of this library.
|
||||||
var Version = V{1, 1, 9}
|
var Version = V{1, 1, 16}
|
||||||
|
|
||||||
// V holds the version of this library.
|
// V holds the version of this library.
|
||||||
type V struct {
|
type V struct {
|
||||||
|
|
5
vendor/github.com/miekg/dns/xfr.go
generated
vendored
5
vendor/github.com/miekg/dns/xfr.go
generated
vendored
|
@ -198,11 +198,14 @@ func (t *Transfer) Out(w ResponseWriter, q *Msg, ch chan *Envelope) error {
|
||||||
r.Authoritative = true
|
r.Authoritative = true
|
||||||
// assume it fits TODO(miek): fix
|
// assume it fits TODO(miek): fix
|
||||||
r.Answer = append(r.Answer, x.RR...)
|
r.Answer = append(r.Answer, x.RR...)
|
||||||
|
if tsig := q.IsTsig(); tsig != nil && w.TsigStatus() == nil {
|
||||||
|
r.SetTsig(tsig.Hdr.Name, tsig.Algorithm, tsig.Fudge, time.Now().Unix())
|
||||||
|
}
|
||||||
if err := w.WriteMsg(r); err != nil {
|
if err := w.WriteMsg(r); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
w.TsigTimersOnly(true)
|
w.TsigTimersOnly(true)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
vendor/github.com/miekg/dns/ztypes.go
generated
vendored
16
vendor/github.com/miekg/dns/ztypes.go
generated
vendored
|
@ -312,12 +312,12 @@ func (rr *DS) len(off int, compression map[string]struct{}) int {
|
||||||
l += 2 // KeyTag
|
l += 2 // KeyTag
|
||||||
l++ // Algorithm
|
l++ // Algorithm
|
||||||
l++ // DigestType
|
l++ // DigestType
|
||||||
l += len(rr.Digest)/2 + 1
|
l += len(rr.Digest) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *EID) len(off int, compression map[string]struct{}) int {
|
func (rr *EID) len(off int, compression map[string]struct{}) int {
|
||||||
l := rr.Hdr.len(off, compression)
|
l := rr.Hdr.len(off, compression)
|
||||||
l += len(rr.Endpoint)/2 + 1
|
l += len(rr.Endpoint) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *EUI48) len(off int, compression map[string]struct{}) int {
|
func (rr *EUI48) len(off int, compression map[string]struct{}) int {
|
||||||
|
@ -452,7 +452,7 @@ func (rr *NID) len(off int, compression map[string]struct{}) int {
|
||||||
}
|
}
|
||||||
func (rr *NIMLOC) len(off int, compression map[string]struct{}) int {
|
func (rr *NIMLOC) len(off int, compression map[string]struct{}) int {
|
||||||
l := rr.Hdr.len(off, compression)
|
l := rr.Hdr.len(off, compression)
|
||||||
l += len(rr.Locator)/2 + 1
|
l += len(rr.Locator) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *NINFO) len(off int, compression map[string]struct{}) int {
|
func (rr *NINFO) len(off int, compression map[string]struct{}) int {
|
||||||
|
@ -505,7 +505,7 @@ func (rr *PX) len(off int, compression map[string]struct{}) int {
|
||||||
}
|
}
|
||||||
func (rr *RFC3597) len(off int, compression map[string]struct{}) int {
|
func (rr *RFC3597) len(off int, compression map[string]struct{}) int {
|
||||||
l := rr.Hdr.len(off, compression)
|
l := rr.Hdr.len(off, compression)
|
||||||
l += len(rr.Rdata)/2 + 1
|
l += len(rr.Rdata) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *RKEY) len(off int, compression map[string]struct{}) int {
|
func (rr *RKEY) len(off int, compression map[string]struct{}) int {
|
||||||
|
@ -546,7 +546,7 @@ func (rr *SMIMEA) len(off int, compression map[string]struct{}) int {
|
||||||
l++ // Usage
|
l++ // Usage
|
||||||
l++ // Selector
|
l++ // Selector
|
||||||
l++ // MatchingType
|
l++ // MatchingType
|
||||||
l += len(rr.Certificate)/2 + 1
|
l += len(rr.Certificate) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *SOA) len(off int, compression map[string]struct{}) int {
|
func (rr *SOA) len(off int, compression map[string]struct{}) int {
|
||||||
|
@ -579,7 +579,7 @@ func (rr *SSHFP) len(off int, compression map[string]struct{}) int {
|
||||||
l := rr.Hdr.len(off, compression)
|
l := rr.Hdr.len(off, compression)
|
||||||
l++ // Algorithm
|
l++ // Algorithm
|
||||||
l++ // Type
|
l++ // Type
|
||||||
l += len(rr.FingerPrint)/2 + 1
|
l += len(rr.FingerPrint) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *TA) len(off int, compression map[string]struct{}) int {
|
func (rr *TA) len(off int, compression map[string]struct{}) int {
|
||||||
|
@ -587,7 +587,7 @@ func (rr *TA) len(off int, compression map[string]struct{}) int {
|
||||||
l += 2 // KeyTag
|
l += 2 // KeyTag
|
||||||
l++ // Algorithm
|
l++ // Algorithm
|
||||||
l++ // DigestType
|
l++ // DigestType
|
||||||
l += len(rr.Digest)/2 + 1
|
l += len(rr.Digest) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *TALINK) len(off int, compression map[string]struct{}) int {
|
func (rr *TALINK) len(off int, compression map[string]struct{}) int {
|
||||||
|
@ -614,7 +614,7 @@ func (rr *TLSA) len(off int, compression map[string]struct{}) int {
|
||||||
l++ // Usage
|
l++ // Usage
|
||||||
l++ // Selector
|
l++ // Selector
|
||||||
l++ // MatchingType
|
l++ // MatchingType
|
||||||
l += len(rr.Certificate)/2 + 1
|
l += len(rr.Certificate) / 2
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
func (rr *TSIG) len(off int, compression map[string]struct{}) int {
|
func (rr *TSIG) len(off int, compression map[string]struct{}) int {
|
||||||
|
|
5
vendor/golang.org/x/crypto/ed25519/ed25519.go
generated
vendored
5
vendor/golang.org/x/crypto/ed25519/ed25519.go
generated
vendored
|
@ -2,6 +2,11 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// In Go 1.13, the ed25519 package was promoted to the standard library as
|
||||||
|
// crypto/ed25519, and this package became a wrapper for the standard library one.
|
||||||
|
//
|
||||||
|
// +build !go1.13
|
||||||
|
|
||||||
// Package ed25519 implements the Ed25519 signature algorithm. See
|
// Package ed25519 implements the Ed25519 signature algorithm. See
|
||||||
// https://ed25519.cr.yp.to/.
|
// https://ed25519.cr.yp.to/.
|
||||||
//
|
//
|
||||||
|
|
73
vendor/golang.org/x/crypto/ed25519/ed25519_go113.go
generated
vendored
Normal file
73
vendor/golang.org/x/crypto/ed25519/ed25519_go113.go
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build go1.13
|
||||||
|
|
||||||
|
// Package ed25519 implements the Ed25519 signature algorithm. See
|
||||||
|
// https://ed25519.cr.yp.to/.
|
||||||
|
//
|
||||||
|
// These functions are also compatible with the “Ed25519” function defined in
|
||||||
|
// RFC 8032. However, unlike RFC 8032's formulation, this package's private key
|
||||||
|
// representation includes a public key suffix to make multiple signing
|
||||||
|
// operations with the same key more efficient. This package refers to the RFC
|
||||||
|
// 8032 private key as the “seed”.
|
||||||
|
//
|
||||||
|
// Beginning with Go 1.13, the functionality of this package was moved to the
|
||||||
|
// standard library as crypto/ed25519. This package only acts as a compatibility
|
||||||
|
// wrapper.
|
||||||
|
package ed25519
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/ed25519"
|
||||||
|
"io"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// PublicKeySize is the size, in bytes, of public keys as used in this package.
|
||||||
|
PublicKeySize = 32
|
||||||
|
// PrivateKeySize is the size, in bytes, of private keys as used in this package.
|
||||||
|
PrivateKeySize = 64
|
||||||
|
// SignatureSize is the size, in bytes, of signatures generated and verified by this package.
|
||||||
|
SignatureSize = 64
|
||||||
|
// SeedSize is the size, in bytes, of private key seeds. These are the private key representations used by RFC 8032.
|
||||||
|
SeedSize = 32
|
||||||
|
)
|
||||||
|
|
||||||
|
// PublicKey is the type of Ed25519 public keys.
|
||||||
|
//
|
||||||
|
// This type is an alias for crypto/ed25519's PublicKey type.
|
||||||
|
// See the crypto/ed25519 package for the methods on this type.
|
||||||
|
type PublicKey = ed25519.PublicKey
|
||||||
|
|
||||||
|
// PrivateKey is the type of Ed25519 private keys. It implements crypto.Signer.
|
||||||
|
//
|
||||||
|
// This type is an alias for crypto/ed25519's PrivateKey type.
|
||||||
|
// See the crypto/ed25519 package for the methods on this type.
|
||||||
|
type PrivateKey = ed25519.PrivateKey
|
||||||
|
|
||||||
|
// GenerateKey generates a public/private key pair using entropy from rand.
|
||||||
|
// If rand is nil, crypto/rand.Reader will be used.
|
||||||
|
func GenerateKey(rand io.Reader) (PublicKey, PrivateKey, error) {
|
||||||
|
return ed25519.GenerateKey(rand)
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewKeyFromSeed calculates a private key from a seed. It will panic if
|
||||||
|
// len(seed) is not SeedSize. This function is provided for interoperability
|
||||||
|
// with RFC 8032. RFC 8032's private keys correspond to seeds in this
|
||||||
|
// package.
|
||||||
|
func NewKeyFromSeed(seed []byte) PrivateKey {
|
||||||
|
return ed25519.NewKeyFromSeed(seed)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sign signs the message with privateKey and returns a signature. It will
|
||||||
|
// panic if len(privateKey) is not PrivateKeySize.
|
||||||
|
func Sign(privateKey PrivateKey, message []byte) []byte {
|
||||||
|
return ed25519.Sign(privateKey, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify reports whether sig is a valid signature of message by publicKey. It
|
||||||
|
// will panic if len(publicKey) is not PublicKeySize.
|
||||||
|
func Verify(publicKey PublicKey, message, sig []byte) bool {
|
||||||
|
return ed25519.Verify(publicKey, message, sig)
|
||||||
|
}
|
3
vendor/golang.org/x/net/bpf/vm_instructions.go
generated
vendored
3
vendor/golang.org/x/net/bpf/vm_instructions.go
generated
vendored
|
@ -129,7 +129,8 @@ func loadIndirect(ins LoadIndirect, in []byte, regX uint32) (uint32, bool) {
|
||||||
func loadMemShift(ins LoadMemShift, in []byte) (uint32, bool) {
|
func loadMemShift(ins LoadMemShift, in []byte) (uint32, bool) {
|
||||||
offset := int(ins.Off)
|
offset := int(ins.Off)
|
||||||
|
|
||||||
if !inBounds(len(in), offset, 0) {
|
// Size of LoadMemShift is always 1 byte
|
||||||
|
if !inBounds(len(in), offset, 1) {
|
||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go
generated
vendored
2
vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go
generated
vendored
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x
|
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_aix.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_aix.go
generated
vendored
|
@ -16,14 +16,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_darwin.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_darwin.go
generated
vendored
|
@ -16,14 +16,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_dragonfly.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_dragonfly.go
generated
vendored
|
@ -16,14 +16,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_freebsd.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_freebsd.go
generated
vendored
|
@ -16,14 +16,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_linux.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_linux.go
generated
vendored
|
@ -18,14 +18,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_netbsd.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_netbsd.go
generated
vendored
|
@ -16,14 +16,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_openbsd.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_openbsd.go
generated
vendored
|
@ -16,14 +16,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/defs_solaris.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/defs_solaris.go
generated
vendored
|
@ -16,14 +16,6 @@ package socket
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = C.AF_UNSPEC
|
|
||||||
sysAF_INET = C.AF_INET
|
|
||||||
sysAF_INET6 = C.AF_INET6
|
|
||||||
|
|
||||||
sysSOCK_RAW = C.SOCK_RAW
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec C.struct_iovec
|
type iovec C.struct_iovec
|
||||||
|
|
||||||
type msghdr C.struct_msghdr
|
type msghdr C.struct_msghdr
|
||||||
|
|
2
vendor/golang.org/x/net/internal/socket/iovec_64bit.go
generated
vendored
2
vendor/golang.org/x/net/internal/socket/iovec_64bit.go
generated
vendored
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x
|
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
2
vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go
generated
vendored
2
vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go
generated
vendored
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le s390x
|
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
17
vendor/golang.org/x/net/internal/socket/sys_const_unix.go
generated
vendored
Normal file
17
vendor/golang.org/x/net/internal/socket/sys_const_unix.go
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
|
package socket
|
||||||
|
|
||||||
|
import "golang.org/x/sys/unix"
|
||||||
|
|
||||||
|
const (
|
||||||
|
sysAF_UNSPEC = unix.AF_UNSPEC
|
||||||
|
sysAF_INET = unix.AF_INET
|
||||||
|
sysAF_INET6 = unix.AF_INET6
|
||||||
|
|
||||||
|
sysSOCK_RAW = unix.SOCK_RAW
|
||||||
|
)
|
12
vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go
generated
vendored
Normal file
12
vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build riscv64
|
||||||
|
|
||||||
|
package socket
|
||||||
|
|
||||||
|
const (
|
||||||
|
sysRECVMMSG = 0xf3
|
||||||
|
sysSENDMMSG = 0x10d
|
||||||
|
)
|
6
vendor/golang.org/x/net/internal/socket/sys_posix.go
generated
vendored
6
vendor/golang.org/x/net/internal/socket/sys_posix.go
generated
vendored
|
@ -33,7 +33,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte {
|
||||||
if ip4 := ip.To4(); ip4 != nil {
|
if ip4 := ip.To4(); ip4 != nil {
|
||||||
b := make([]byte, sizeofSockaddrInet)
|
b := make([]byte, sizeofSockaddrInet)
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android", "linux", "solaris", "windows":
|
case "android", "illumos", "linux", "solaris", "windows":
|
||||||
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET))
|
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET))
|
||||||
default:
|
default:
|
||||||
b[0] = sizeofSockaddrInet
|
b[0] = sizeofSockaddrInet
|
||||||
|
@ -46,7 +46,7 @@ func marshalSockaddr(ip net.IP, port int, zone string) []byte {
|
||||||
if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil {
|
if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil {
|
||||||
b := make([]byte, sizeofSockaddrInet6)
|
b := make([]byte, sizeofSockaddrInet6)
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android", "linux", "solaris", "windows":
|
case "android", "illumos", "linux", "solaris", "windows":
|
||||||
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6))
|
NativeEndian.PutUint16(b[:2], uint16(sysAF_INET6))
|
||||||
default:
|
default:
|
||||||
b[0] = sizeofSockaddrInet6
|
b[0] = sizeofSockaddrInet6
|
||||||
|
@ -68,7 +68,7 @@ func parseInetAddr(b []byte, network string) (net.Addr, error) {
|
||||||
}
|
}
|
||||||
var af int
|
var af int
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "android", "linux", "solaris", "windows":
|
case "android", "illumos", "linux", "solaris", "windows":
|
||||||
af = int(NativeEndian.Uint16(b[:2]))
|
af = int(NativeEndian.Uint16(b[:2]))
|
||||||
default:
|
default:
|
||||||
af = int(b[1])
|
af = int(b[1])
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/sys_windows.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/sys_windows.go
generated
vendored
|
@ -7,6 +7,8 @@ package socket
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
func probeProtocolStack() int {
|
func probeProtocolStack() int {
|
||||||
|
@ -15,11 +17,11 @@ func probeProtocolStack() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sysAF_UNSPEC = 0x0
|
sysAF_UNSPEC = windows.AF_UNSPEC
|
||||||
sysAF_INET = 0x2
|
sysAF_INET = windows.AF_INET
|
||||||
sysAF_INET6 = 0x17
|
sysAF_INET6 = windows.AF_INET6
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
sysSOCK_RAW = windows.SOCK_RAW
|
||||||
)
|
)
|
||||||
|
|
||||||
type sockaddrInet struct {
|
type sockaddrInet struct {
|
||||||
|
|
8
vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go
generated
vendored
8
vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go
generated
vendored
|
@ -6,14 +6,6 @@
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x18
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_darwin.go
|
// cgo -godefs defs_darwin.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1e
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_darwin.go
|
// cgo -godefs defs_darwin.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1e
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_darwin.go
|
// cgo -godefs defs_darwin.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1e
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_darwin_arm64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_darwin.go
|
// cgo -godefs defs_darwin.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1e
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_dragonfly.go
|
// cgo -godefs defs_dragonfly.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1c
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_freebsd.go
|
// cgo -godefs defs_freebsd.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1c
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_freebsd.go
|
// cgo -godefs defs_freebsd.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1c
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_freebsd.go
|
// cgo -godefs defs_freebsd.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x1c
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
53
vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go
generated
vendored
Normal file
53
vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs defs_freebsd.go
|
||||||
|
|
||||||
|
package socket
|
||||||
|
|
||||||
|
type iovec struct {
|
||||||
|
Base *byte
|
||||||
|
Len uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type msghdr struct {
|
||||||
|
Name *byte
|
||||||
|
Namelen uint32
|
||||||
|
Pad_cgo_0 [4]byte
|
||||||
|
Iov *iovec
|
||||||
|
Iovlen int32
|
||||||
|
Pad_cgo_1 [4]byte
|
||||||
|
Control *byte
|
||||||
|
Controllen uint32
|
||||||
|
Flags int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type cmsghdr struct {
|
||||||
|
Len uint32
|
||||||
|
Level int32
|
||||||
|
Type int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
Port uint16
|
||||||
|
Addr [4]byte /* in_addr */
|
||||||
|
Zero [8]int8
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet6 struct {
|
||||||
|
Len uint8
|
||||||
|
Family uint8
|
||||||
|
Port uint16
|
||||||
|
Flowinfo uint32
|
||||||
|
Addr [16]byte /* in6_addr */
|
||||||
|
Scope_id uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
sizeofIovec = 0x10
|
||||||
|
sizeofMsghdr = 0x30
|
||||||
|
sizeofCmsghdr = 0xc
|
||||||
|
|
||||||
|
sizeofSockaddrInet = 0x10
|
||||||
|
sizeofSockaddrInet6 = 0x1c
|
||||||
|
)
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_386.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_386.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
59
vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go
generated
vendored
Normal file
59
vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
|
// +build riscv64
|
||||||
|
|
||||||
|
package socket
|
||||||
|
|
||||||
|
type iovec struct {
|
||||||
|
Base *byte
|
||||||
|
Len uint64
|
||||||
|
}
|
||||||
|
|
||||||
|
type msghdr struct {
|
||||||
|
Name *byte
|
||||||
|
Namelen uint32
|
||||||
|
Iov *iovec
|
||||||
|
Iovlen uint64
|
||||||
|
Control *byte
|
||||||
|
Controllen uint64
|
||||||
|
Flags int32
|
||||||
|
Pad_cgo_0 [4]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type mmsghdr struct {
|
||||||
|
Hdr msghdr
|
||||||
|
Len uint32
|
||||||
|
Pad_cgo_0 [4]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type cmsghdr struct {
|
||||||
|
Len uint64
|
||||||
|
Level int32
|
||||||
|
Type int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet struct {
|
||||||
|
Family uint16
|
||||||
|
Port uint16
|
||||||
|
Addr [4]byte /* in_addr */
|
||||||
|
X__pad [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet6 struct {
|
||||||
|
Family uint16
|
||||||
|
Port uint16
|
||||||
|
Flowinfo uint32
|
||||||
|
Addr [16]byte /* in6_addr */
|
||||||
|
Scope_id uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
sizeofIovec = 0x10
|
||||||
|
sizeofMsghdr = 0x38
|
||||||
|
sizeofMmsghdr = 0x40
|
||||||
|
sizeofCmsghdr = 0x10
|
||||||
|
|
||||||
|
sizeofSockaddrInet = 0x10
|
||||||
|
sizeofSockaddrInet6 = 0x1c
|
||||||
|
)
|
10
vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_linux.go
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0xa
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_netbsd.go
|
// cgo -godefs defs_netbsd.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x18
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_netbsd.go
|
// cgo -godefs defs_netbsd.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x18
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint64
|
Len uint64
|
||||||
|
|
10
vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go
generated
vendored
10
vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go
generated
vendored
|
@ -1,16 +1,8 @@
|
||||||
// Created by cgo -godefs - DO NOT EDIT
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
// cgo -godefs defs_netbsd.go
|
// cgo -godefs defs_netbsd.go
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
const (
|
|
||||||
sysAF_UNSPEC = 0x0
|
|
||||||
sysAF_INET = 0x2
|
|
||||||
sysAF_INET6 = 0x18
|
|
||||||
|
|
||||||
sysSOCK_RAW = 0x3
|
|
||||||
)
|
|
||||||
|
|
||||||
type iovec struct {
|
type iovec struct {
|
||||||
Base *byte
|
Base *byte
|
||||||
Len uint32
|
Len uint32
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue