mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-03 21:27:37 +03:00
Update quic-go
This commit is contained in:
parent
8523a92437
commit
6e1bc06477
19 changed files with 336 additions and 136 deletions
6
go.mod
6
go.mod
|
@ -18,12 +18,12 @@ require (
|
|||
github.com/jedisct1/xsecretbox v0.0.0-20210927135450-ebe41aef7bef
|
||||
github.com/k-sone/critbitgo v1.4.0
|
||||
github.com/kardianos/service v1.2.1
|
||||
github.com/lucas-clemente/quic-go v0.28.0
|
||||
github.com/lucas-clemente/quic-go v0.28.1
|
||||
github.com/miekg/dns v1.1.50
|
||||
github.com/powerman/check v1.6.0
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
|
||||
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462
|
||||
golang.org/x/sys v0.0.0-20220731174439-a90be440212d
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
)
|
||||
|
||||
|
|
12
go.sum
12
go.sum
|
@ -454,8 +454,8 @@ github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
|||
github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/lib/pq v1.9.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||
github.com/lucas-clemente/quic-go v0.28.0 h1:9eXVRgIkMQQyiyorz/dAaOYIx3TFzXsIFkNFz4cxuJM=
|
||||
github.com/lucas-clemente/quic-go v0.28.0/go.mod h1:oGz5DKK41cJt5+773+BSO9BXDsREY4HLf7+0odGAPO0=
|
||||
github.com/lucas-clemente/quic-go v0.28.1 h1:Uo0lvVxWg5la9gflIF9lwa39ONq85Xq2D91YNEIslzU=
|
||||
github.com/lucas-clemente/quic-go v0.28.1/go.mod h1:oGz5DKK41cJt5+773+BSO9BXDsREY4HLf7+0odGAPO0=
|
||||
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4=
|
||||
|
@ -894,8 +894,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
|
|||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462 h1:UreQrH7DbFXSi9ZFox6FNT3WBooWmdANpU+IfkT1T4I=
|
||||
golang.org/x/net v0.0.0-20220728211354-c7608f3a8462/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
|
@ -978,8 +978,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220731174439-a90be440212d h1:Sv5ogFZatcgIMMtBSTTAgMYsicp25MXBubjXNDKwm80=
|
||||
golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
|
|
4
vendor/github.com/lucas-clemente/quic-go/README.md
generated
vendored
4
vendor/github.com/lucas-clemente/quic-go/README.md
generated
vendored
|
@ -5,9 +5,9 @@
|
|||
[](https://pkg.go.dev/github.com/lucas-clemente/quic-go)
|
||||
[](https://codecov.io/gh/lucas-clemente/quic-go/)
|
||||
|
||||
quic-go is an implementation of the [QUIC protocol, RFC 9000](https://datatracker.ietf.org/doc/html/rfc9000) protocol in Go, including the [Unreliable Datagram Extension, RFC 9221](https://datatracker.ietf.org/doc/html/rfc9221).
|
||||
quic-go is an implementation of the QUIC protocol ([RFC 9000](https://datatracker.ietf.org/doc/html/rfc9000), [RFC 9001](https://datatracker.ietf.org/doc/html/rfc9001), [RFC 9002](https://datatracker.ietf.org/doc/html/rfc9002)) in Go, including the [Unreliable Datagram Extension, RFC 9221](https://datatracker.ietf.org/doc/html/rfc9221). It has support for HTTP/3 [RFC 9114](https://datatracker.ietf.org/doc/html/rfc9114).
|
||||
|
||||
In addition to RFC 9000, it currently implements the [IETF QUIC draft-29](https://tools.ietf.org/html/draft-ietf-quic-transport-29). Support for draft-29 will eventually be dropped, as it is phased out of the ecosystem.
|
||||
In addition the RFCs listed above, it currently implements the [IETF QUIC draft-29](https://tools.ietf.org/html/draft-ietf-quic-transport-29). Support for draft-29 will eventually be dropped, as it is phased out of the ecosystem.
|
||||
|
||||
## Guides
|
||||
|
||||
|
|
4
vendor/github.com/lucas-clemente/quic-go/http3/body.go
generated
vendored
4
vendor/github.com/lucas-clemente/quic-go/http3/body.go
generated
vendored
|
@ -110,7 +110,9 @@ func (r *hijackableBody) requestDone() {
|
|||
if r.reqDoneClosed || r.reqDone == nil {
|
||||
return
|
||||
}
|
||||
close(r.reqDone)
|
||||
if r.reqDone != nil {
|
||||
close(r.reqDone)
|
||||
}
|
||||
r.reqDoneClosed = true
|
||||
}
|
||||
|
||||
|
|
15
vendor/github.com/lucas-clemente/quic-go/http3/client.go
generated
vendored
15
vendor/github.com/lucas-clemente/quic-go/http3/client.go
generated
vendored
|
@ -273,7 +273,9 @@ func (c *client) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Respon
|
|||
// This go routine keeps running even after RoundTripOpt() returns.
|
||||
// It is shut down when the application is done processing the body.
|
||||
reqDone := make(chan struct{})
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
defer close(done)
|
||||
select {
|
||||
case <-req.Context().Done():
|
||||
str.CancelWrite(quic.StreamErrorCode(errorRequestCanceled))
|
||||
|
@ -282,9 +284,14 @@ func (c *client) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Respon
|
|||
}
|
||||
}()
|
||||
|
||||
rsp, rerr := c.doRequest(req, str, opt, reqDone)
|
||||
doneChan := reqDone
|
||||
if opt.DontCloseRequestStream {
|
||||
doneChan = nil
|
||||
}
|
||||
rsp, rerr := c.doRequest(req, str, opt, doneChan)
|
||||
if rerr.err != nil { // if any error occurred
|
||||
close(reqDone)
|
||||
<-done
|
||||
if rerr.streamErr != 0 { // if it was a stream error
|
||||
str.CancelWrite(quic.StreamErrorCode(rerr.streamErr))
|
||||
}
|
||||
|
@ -296,6 +303,10 @@ func (c *client) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Respon
|
|||
c.conn.CloseWithError(quic.ApplicationErrorCode(rerr.connErr), reason)
|
||||
}
|
||||
}
|
||||
if opt.DontCloseRequestStream {
|
||||
close(reqDone)
|
||||
<-done
|
||||
}
|
||||
return rsp, rerr.err
|
||||
}
|
||||
|
||||
|
@ -326,7 +337,7 @@ func (c *client) sendRequestBody(str Stream, body io.ReadCloser) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *client) doRequest(req *http.Request, str quic.Stream, opt RoundTripOpt, reqDone chan struct{}) (*http.Response, requestError) {
|
||||
func (c *client) doRequest(req *http.Request, str quic.Stream, opt RoundTripOpt, reqDone chan<- struct{}) (*http.Response, requestError) {
|
||||
var requestGzip bool
|
||||
if !c.opts.DisableCompression && req.Method != "HEAD" && req.Header.Get("Accept-Encoding") == "" && req.Header.Get("Range") == "" {
|
||||
requestGzip = true
|
||||
|
|
1
vendor/github.com/lucas-clemente/quic-go/http3/roundtrip.go
generated
vendored
1
vendor/github.com/lucas-clemente/quic-go/http3/roundtrip.go
generated
vendored
|
@ -84,6 +84,7 @@ type RoundTripOpt struct {
|
|||
// If set true and no cached connection is available, RoundTripOpt will return ErrNoCachedConn.
|
||||
OnlyCachedConn bool
|
||||
// DontCloseRequestStream controls whether the request stream is closed after sending the request.
|
||||
// If set, context cancellations have no effect after the response headers are received.
|
||||
DontCloseRequestStream bool
|
||||
}
|
||||
|
||||
|
|
48
vendor/golang.org/x/net/internal/socket/rawconn_msg.go
generated
vendored
48
vendor/golang.org/x/net/internal/socket/rawconn_msg.go
generated
vendored
|
@ -8,22 +8,21 @@
|
|||
package socket
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
)
|
||||
|
||||
func (c *Conn) recvMsg(m *Message, flags int) error {
|
||||
m.raceWrite()
|
||||
var h msghdr
|
||||
vs := make([]iovec, len(m.Buffers))
|
||||
var sa []byte
|
||||
if c.network != "tcp" {
|
||||
sa = make([]byte, sizeofSockaddrInet6)
|
||||
}
|
||||
h.pack(vs, m.Buffers, m.OOB, sa)
|
||||
var operr error
|
||||
var n int
|
||||
var (
|
||||
operr error
|
||||
n int
|
||||
oobn int
|
||||
recvflags int
|
||||
from net.Addr
|
||||
)
|
||||
fn := func(s uintptr) bool {
|
||||
n, operr = recvmsg(s, &h, flags)
|
||||
n, oobn, recvflags, from, operr = recvmsg(s, m.Buffers, m.OOB, flags, c.network)
|
||||
return ioComplete(flags, operr)
|
||||
}
|
||||
if err := c.c.Read(fn); err != nil {
|
||||
|
@ -32,34 +31,21 @@ func (c *Conn) recvMsg(m *Message, flags int) error {
|
|||
if operr != nil {
|
||||
return os.NewSyscallError("recvmsg", operr)
|
||||
}
|
||||
if c.network != "tcp" {
|
||||
var err error
|
||||
m.Addr, err = parseInetAddr(sa[:], c.network)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
m.Addr = from
|
||||
m.N = n
|
||||
m.NN = h.controllen()
|
||||
m.Flags = h.flags()
|
||||
m.NN = oobn
|
||||
m.Flags = recvflags
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Conn) sendMsg(m *Message, flags int) error {
|
||||
m.raceRead()
|
||||
var h msghdr
|
||||
vs := make([]iovec, len(m.Buffers))
|
||||
var sa []byte
|
||||
if m.Addr != nil {
|
||||
var a [sizeofSockaddrInet6]byte
|
||||
n := marshalInetAddr(m.Addr, a[:])
|
||||
sa = a[:n]
|
||||
}
|
||||
h.pack(vs, m.Buffers, m.OOB, sa)
|
||||
var operr error
|
||||
var n int
|
||||
var (
|
||||
operr error
|
||||
n int
|
||||
)
|
||||
fn := func(s uintptr) bool {
|
||||
n, operr = sendmsg(s, &h, flags)
|
||||
n, operr = sendmsg(s, m.Buffers, m.OOB, m.Addr, flags)
|
||||
return ioComplete(flags, operr)
|
||||
}
|
||||
if err := c.c.Write(fn); err != nil {
|
||||
|
|
6
vendor/golang.org/x/net/internal/socket/sys_stub.go
generated
vendored
6
vendor/golang.org/x/net/internal/socket/sys_stub.go
generated
vendored
|
@ -36,11 +36,11 @@ func setsockopt(s uintptr, level, name int, b []byte) error {
|
|||
return errNotImplemented
|
||||
}
|
||||
|
||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
return 0, errNotImplemented
|
||||
func recvmsg(s uintptr, buffers [][]byte, oob []byte, flags int, network string) (n, oobn int, recvflags int, from net.Addr, err error) {
|
||||
return 0, 0, 0, nil, errNotImplemented
|
||||
}
|
||||
|
||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
func sendmsg(s uintptr, buffers [][]byte, oob []byte, to net.Addr, flags int) (int, error) {
|
||||
return 0, errNotImplemented
|
||||
}
|
||||
|
||||
|
|
101
vendor/golang.org/x/net/internal/socket/sys_unix.go
generated
vendored
101
vendor/golang.org/x/net/internal/socket/sys_unix.go
generated
vendored
|
@ -8,8 +8,10 @@
|
|||
package socket
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
"net"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
//go:linkname syscall_getsockopt syscall.getsockopt
|
||||
|
@ -18,12 +20,6 @@ func syscall_getsockopt(s, level, name int, val unsafe.Pointer, vallen *uint32)
|
|||
//go:linkname syscall_setsockopt syscall.setsockopt
|
||||
func syscall_setsockopt(s, level, name int, val unsafe.Pointer, vallen uintptr) error
|
||||
|
||||
//go:linkname syscall_recvmsg syscall.recvmsg
|
||||
func syscall_recvmsg(s int, msg *syscall.Msghdr, flags int) (int, error)
|
||||
|
||||
//go:linkname syscall_sendmsg syscall.sendmsg
|
||||
func syscall_sendmsg(s int, msg *syscall.Msghdr, flags int) (int, error)
|
||||
|
||||
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
|
||||
l := uint32(len(b))
|
||||
err := syscall_getsockopt(int(s), level, name, unsafe.Pointer(&b[0]), &l)
|
||||
|
@ -34,10 +30,93 @@ func setsockopt(s uintptr, level, name int, b []byte) error {
|
|||
return syscall_setsockopt(int(s), level, name, unsafe.Pointer(&b[0]), uintptr(len(b)))
|
||||
}
|
||||
|
||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
return syscall_recvmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags)
|
||||
func recvmsg(s uintptr, buffers [][]byte, oob []byte, flags int, network string) (n, oobn int, recvflags int, from net.Addr, err error) {
|
||||
var unixFrom unix.Sockaddr
|
||||
n, oobn, recvflags, unixFrom, err = unix.RecvmsgBuffers(int(s), buffers, oob, flags)
|
||||
if unixFrom != nil {
|
||||
from = sockaddrToAddr(unixFrom, network)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
return syscall_sendmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags)
|
||||
func sendmsg(s uintptr, buffers [][]byte, oob []byte, to net.Addr, flags int) (int, error) {
|
||||
var unixTo unix.Sockaddr
|
||||
if to != nil {
|
||||
unixTo = addrToSockaddr(to)
|
||||
}
|
||||
return unix.SendmsgBuffers(int(s), buffers, oob, unixTo, flags)
|
||||
}
|
||||
|
||||
// addrToSockaddr converts a net.Addr to a unix.Sockaddr.
|
||||
func addrToSockaddr(a net.Addr) unix.Sockaddr {
|
||||
var (
|
||||
ip net.IP
|
||||
port int
|
||||
zone string
|
||||
)
|
||||
switch a := a.(type) {
|
||||
case *net.TCPAddr:
|
||||
ip = a.IP
|
||||
port = a.Port
|
||||
zone = a.Zone
|
||||
case *net.UDPAddr:
|
||||
ip = a.IP
|
||||
port = a.Port
|
||||
zone = a.Zone
|
||||
case *net.IPAddr:
|
||||
ip = a.IP
|
||||
zone = a.Zone
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
if ip4 := ip.To4(); ip4 != nil {
|
||||
sa := unix.SockaddrInet4{Port: port}
|
||||
copy(sa.Addr[:], ip4)
|
||||
return &sa
|
||||
}
|
||||
|
||||
if ip6 := ip.To16(); ip6 != nil && ip.To4() == nil {
|
||||
sa := unix.SockaddrInet6{Port: port}
|
||||
copy(sa.Addr[:], ip6)
|
||||
if zone != "" {
|
||||
sa.ZoneId = uint32(zoneCache.index(zone))
|
||||
}
|
||||
return &sa
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// sockaddrToAddr converts a unix.Sockaddr to a net.Addr.
|
||||
func sockaddrToAddr(sa unix.Sockaddr, network string) net.Addr {
|
||||
var (
|
||||
ip net.IP
|
||||
port int
|
||||
zone string
|
||||
)
|
||||
switch sa := sa.(type) {
|
||||
case *unix.SockaddrInet4:
|
||||
ip = make(net.IP, net.IPv4len)
|
||||
copy(ip, sa.Addr[:])
|
||||
port = sa.Port
|
||||
case *unix.SockaddrInet6:
|
||||
ip = make(net.IP, net.IPv6len)
|
||||
copy(ip, sa.Addr[:])
|
||||
port = sa.Port
|
||||
if sa.ZoneId > 0 {
|
||||
zone = zoneCache.name(int(sa.ZoneId))
|
||||
}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
switch network {
|
||||
case "tcp", "tcp4", "tcp6":
|
||||
return &net.TCPAddr{IP: ip, Port: port, Zone: zone}
|
||||
case "udp", "udp4", "udp6":
|
||||
return &net.UDPAddr{IP: ip, Port: port, Zone: zone}
|
||||
default:
|
||||
return &net.IPAddr{IP: ip, Zone: zone}
|
||||
}
|
||||
}
|
||||
|
|
7
vendor/golang.org/x/net/internal/socket/sys_windows.go
generated
vendored
7
vendor/golang.org/x/net/internal/socket/sys_windows.go
generated
vendored
|
@ -5,6 +5,7 @@
|
|||
package socket
|
||||
|
||||
import (
|
||||
"net"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
|
@ -37,11 +38,11 @@ func setsockopt(s uintptr, level, name int, b []byte) error {
|
|||
return syscall.Setsockopt(syscall.Handle(s), int32(level), int32(name), (*byte)(unsafe.Pointer(&b[0])), int32(len(b)))
|
||||
}
|
||||
|
||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
return 0, errNotImplemented
|
||||
func recvmsg(s uintptr, buffers [][]byte, oob []byte, flags int, network string) (n, oobn int, recvflags int, from net.Addr, err error) {
|
||||
return 0, 0, 0, nil, errNotImplemented
|
||||
}
|
||||
|
||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
func sendmsg(s uintptr, buffers [][]byte, oob []byte, to net.Addr, flags int) (int, error) {
|
||||
return 0, errNotImplemented
|
||||
}
|
||||
|
||||
|
|
37
vendor/golang.org/x/net/internal/socket/sys_zos_s390x.go
generated
vendored
37
vendor/golang.org/x/net/internal/socket/sys_zos_s390x.go
generated
vendored
|
@ -27,12 +27,39 @@ func setsockopt(s uintptr, level, name int, b []byte) error {
|
|||
return errnoErr(errno)
|
||||
}
|
||||
|
||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
n, _, errno := syscall_syscall(syscall.SYS___RECVMSG_A, s, uintptr(unsafe.Pointer(h)), uintptr(flags))
|
||||
return int(n), errnoErr(errno)
|
||||
func recvmsg(s uintptr, buffers [][]byte, oob []byte, flags int, network string) (n, oobn int, recvflags int, from net.Addr, err error) {
|
||||
var h msghdr
|
||||
vs := make([]iovec, len(buffers))
|
||||
var sa []byte
|
||||
if network != "tcp" {
|
||||
sa = make([]byte, sizeofSockaddrInet6)
|
||||
}
|
||||
h.pack(vs, buffers, oob, sa)
|
||||
sn, _, errno := syscall_syscall(syscall.SYS___RECVMSG_A, s, uintptr(unsafe.Pointer(&h)), uintptr(flags))
|
||||
n = int(sn)
|
||||
oobn = h.controllen()
|
||||
recvflags = h.flags()
|
||||
err = errnoErr(errno)
|
||||
if network != "tcp" {
|
||||
var err2 error
|
||||
from, err2 = parseInetAddr(sa, network)
|
||||
if err2 != nil && err == nil {
|
||||
err = err2
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||
n, _, errno := syscall_syscall(syscall.SYS___SENDMSG_A, s, uintptr(unsafe.Pointer(h)), uintptr(flags))
|
||||
func sendmsg(s uintptr, buffers [][]byte, oob []byte, to net.Addr, flags int) (int, error) {
|
||||
var h msghdr
|
||||
vs := make([]iovec, len(buffers))
|
||||
var sa []byte
|
||||
if to != nil {
|
||||
var a [sizeofSockaddrInet6]byte
|
||||
n := marshalInetAddr(to, a[:])
|
||||
sa = a[:n]
|
||||
}
|
||||
h.pack(vs, buffers, oob, sa)
|
||||
n, _, errno := syscall_syscall(syscall.SYS___SENDMSG_A, s, uintptr(unsafe.Pointer(&h)), uintptr(flags))
|
||||
return int(n), errnoErr(errno)
|
||||
}
|
||||
|
|
30
vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go
generated
vendored
30
vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go
generated
vendored
|
@ -1,30 +0,0 @@
|
|||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs defs_darwin.go
|
||||
|
||||
package socket
|
||||
|
||||
type iovec struct {
|
||||
Base *byte
|
||||
Len uint32
|
||||
}
|
||||
|
||||
type msghdr struct {
|
||||
Name *byte
|
||||
Namelen uint32
|
||||
Iov *iovec
|
||||
Iovlen int32
|
||||
Control *byte
|
||||
Controllen uint32
|
||||
Flags int32
|
||||
}
|
||||
|
||||
type cmsghdr struct {
|
||||
Len uint32
|
||||
Level int32
|
||||
Type int32
|
||||
}
|
||||
|
||||
const (
|
||||
sizeofIovec = 0x8
|
||||
sizeofMsghdr = 0x1c
|
||||
)
|
30
vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go
generated
vendored
30
vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go
generated
vendored
|
@ -1,30 +0,0 @@
|
|||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs defs_darwin.go
|
||||
|
||||
package socket
|
||||
|
||||
type iovec struct {
|
||||
Base *byte
|
||||
Len uint32
|
||||
}
|
||||
|
||||
type msghdr struct {
|
||||
Name *byte
|
||||
Namelen uint32
|
||||
Iov *iovec
|
||||
Iovlen int32
|
||||
Control *byte
|
||||
Controllen uint32
|
||||
Flags int32
|
||||
}
|
||||
|
||||
type cmsghdr struct {
|
||||
Len uint32
|
||||
Level int32
|
||||
Type int32
|
||||
}
|
||||
|
||||
const (
|
||||
sizeofIovec = 0x8
|
||||
sizeofMsghdr = 0x1c
|
||||
)
|
57
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
57
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
|
@ -218,13 +218,62 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
|||
}
|
||||
|
||||
func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||
// Recvmsg not implemented on AIX
|
||||
return -1, -1, -1, ENOSYS
|
||||
var msg Msghdr
|
||||
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
||||
msg.Namelen = uint32(SizeofSockaddrAny)
|
||||
var dummy byte
|
||||
if len(oob) > 0 {
|
||||
// receive at least one normal byte
|
||||
if emptyIovecs(iov) {
|
||||
var iova [1]Iovec
|
||||
iova[0].Base = &dummy
|
||||
iova[0].SetLen(1)
|
||||
iov = iova[:]
|
||||
}
|
||||
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
||||
msg.SetControllen(len(oob))
|
||||
}
|
||||
if len(iov) > 0 {
|
||||
msg.Iov = &iov[0]
|
||||
msg.SetIovlen(len(iov))
|
||||
}
|
||||
if n, err = recvmsg(fd, &msg, flags); n == -1 {
|
||||
return
|
||||
}
|
||||
oobn = int(msg.Controllen)
|
||||
recvflags = int(msg.Flags)
|
||||
return
|
||||
}
|
||||
|
||||
func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||
// SendmsgN not implemented on AIX
|
||||
return -1, ENOSYS
|
||||
var msg Msghdr
|
||||
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
||||
msg.Namelen = uint32(salen)
|
||||
var dummy byte
|
||||
var empty bool
|
||||
if len(oob) > 0 {
|
||||
// send at least one normal byte
|
||||
empty = emptyIovecs(iov)
|
||||
if empty {
|
||||
var iova [1]Iovec
|
||||
iova[0].Base = &dummy
|
||||
iova[0].SetLen(1)
|
||||
iov = iova[:]
|
||||
}
|
||||
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
||||
msg.SetControllen(len(oob))
|
||||
}
|
||||
if len(iov) > 0 {
|
||||
msg.Iov = &iov[0]
|
||||
msg.SetIovlen(len(iov))
|
||||
}
|
||||
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if len(oob) > 0 && empty {
|
||||
n = 0
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
|
@ -363,7 +363,7 @@ func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Sockle
|
|||
var empty bool
|
||||
if len(oob) > 0 {
|
||||
// send at least one normal byte
|
||||
empty := emptyIovecs(iov)
|
||||
empty = emptyIovecs(iov)
|
||||
if empty {
|
||||
var iova [1]Iovec
|
||||
iova[0].Base = &dummy
|
||||
|
|
2
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
|
@ -1541,7 +1541,7 @@ func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Sockle
|
|||
var dummy byte
|
||||
var empty bool
|
||||
if len(oob) > 0 {
|
||||
empty := emptyIovecs(iov)
|
||||
empty = emptyIovecs(iov)
|
||||
if empty {
|
||||
var sockType int
|
||||
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
||||
|
|
95
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
95
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
|
@ -417,6 +417,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|||
//sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation
|
||||
//sys GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW
|
||||
//sys GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW
|
||||
//sys QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) = psapi.QueryWorkingSetEx
|
||||
|
||||
// NT Native APIs
|
||||
//sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb
|
||||
|
@ -971,6 +972,32 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) {
|
|||
return unsafe.Pointer(&sa.raw), sl, nil
|
||||
}
|
||||
|
||||
type RawSockaddrBth struct {
|
||||
AddressFamily [2]byte
|
||||
BtAddr [8]byte
|
||||
ServiceClassId [16]byte
|
||||
Port [4]byte
|
||||
}
|
||||
|
||||
type SockaddrBth struct {
|
||||
BtAddr uint64
|
||||
ServiceClassId GUID
|
||||
Port uint32
|
||||
|
||||
raw RawSockaddrBth
|
||||
}
|
||||
|
||||
func (sa *SockaddrBth) sockaddr() (unsafe.Pointer, int32, error) {
|
||||
family := AF_BTH
|
||||
sa.raw = RawSockaddrBth{
|
||||
AddressFamily: *(*[2]byte)(unsafe.Pointer(&family)),
|
||||
BtAddr: *(*[8]byte)(unsafe.Pointer(&sa.BtAddr)),
|
||||
Port: *(*[4]byte)(unsafe.Pointer(&sa.Port)),
|
||||
ServiceClassId: *(*[16]byte)(unsafe.Pointer(&sa.ServiceClassId)),
|
||||
}
|
||||
return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil
|
||||
}
|
||||
|
||||
func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_UNIX:
|
||||
|
@ -1707,3 +1734,71 @@ func LoadResourceData(module, resInfo Handle) (data []byte, err error) {
|
|||
h.Cap = int(size)
|
||||
return
|
||||
}
|
||||
|
||||
// PSAPI_WORKING_SET_EX_BLOCK contains extended working set information for a page.
|
||||
type PSAPI_WORKING_SET_EX_BLOCK uint64
|
||||
|
||||
// Valid returns the validity of this page.
|
||||
// If this bit is 1, the subsequent members are valid; otherwise they should be ignored.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Valid() bool {
|
||||
return (b & 1) == 1
|
||||
}
|
||||
|
||||
// ShareCount is the number of processes that share this page. The maximum value of this member is 7.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) ShareCount() uint64 {
|
||||
return b.intField(1, 3)
|
||||
}
|
||||
|
||||
// Win32Protection is the memory protection attributes of the page. For a list of values, see
|
||||
// https://docs.microsoft.com/en-us/windows/win32/memory/memory-protection-constants
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Win32Protection() uint64 {
|
||||
return b.intField(4, 11)
|
||||
}
|
||||
|
||||
// Shared returns the shared status of this page.
|
||||
// If this bit is 1, the page can be shared.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Shared() bool {
|
||||
return (b & (1 << 15)) == 1
|
||||
}
|
||||
|
||||
// Node is the NUMA node. The maximum value of this member is 63.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Node() uint64 {
|
||||
return b.intField(16, 6)
|
||||
}
|
||||
|
||||
// Locked returns the locked status of this page.
|
||||
// If this bit is 1, the virtual page is locked in physical memory.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Locked() bool {
|
||||
return (b & (1 << 22)) == 1
|
||||
}
|
||||
|
||||
// LargePage returns the large page status of this page.
|
||||
// If this bit is 1, the page is a large page.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) LargePage() bool {
|
||||
return (b & (1 << 23)) == 1
|
||||
}
|
||||
|
||||
// Bad returns the bad status of this page.
|
||||
// If this bit is 1, the page is has been reported as bad.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) Bad() bool {
|
||||
return (b & (1 << 31)) == 1
|
||||
}
|
||||
|
||||
// intField extracts an integer field in the PSAPI_WORKING_SET_EX_BLOCK union.
|
||||
func (b PSAPI_WORKING_SET_EX_BLOCK) intField(start, length int) uint64 {
|
||||
var mask PSAPI_WORKING_SET_EX_BLOCK
|
||||
for pos := start; pos < start+length; pos++ {
|
||||
mask |= (1 << pos)
|
||||
}
|
||||
|
||||
masked := b & mask
|
||||
return uint64(masked >> start)
|
||||
}
|
||||
|
||||
// PSAPI_WORKING_SET_EX_INFORMATION contains extended working set information for a process.
|
||||
type PSAPI_WORKING_SET_EX_INFORMATION struct {
|
||||
// The virtual address.
|
||||
VirtualAddress Pointer
|
||||
// A PSAPI_WORKING_SET_EX_BLOCK union that indicates the attributes of the page at VirtualAddress.
|
||||
VirtualAttributes PSAPI_WORKING_SET_EX_BLOCK
|
||||
}
|
||||
|
|
9
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
9
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
|
@ -408,6 +408,7 @@ var (
|
|||
procGetModuleBaseNameW = modpsapi.NewProc("GetModuleBaseNameW")
|
||||
procGetModuleFileNameExW = modpsapi.NewProc("GetModuleFileNameExW")
|
||||
procGetModuleInformation = modpsapi.NewProc("GetModuleInformation")
|
||||
procQueryWorkingSetEx = modpsapi.NewProc("QueryWorkingSetEx")
|
||||
procSubscribeServiceChangeNotifications = modsechost.NewProc("SubscribeServiceChangeNotifications")
|
||||
procUnsubscribeServiceChangeNotifications = modsechost.NewProc("UnsubscribeServiceChangeNotifications")
|
||||
procGetUserNameExW = modsecur32.NewProc("GetUserNameExW")
|
||||
|
@ -3504,6 +3505,14 @@ func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb
|
|||
return
|
||||
}
|
||||
|
||||
func QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procQueryWorkingSetEx.Addr(), 3, uintptr(process), uintptr(pv), uintptr(cb))
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) {
|
||||
ret = procSubscribeServiceChangeNotifications.Find()
|
||||
if ret != nil {
|
||||
|
|
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
|
@ -315,7 +315,7 @@ github.com/ldez/gomoddirectives
|
|||
# github.com/ldez/tagliatelle v0.2.0
|
||||
## explicit; go 1.16
|
||||
github.com/ldez/tagliatelle
|
||||
# github.com/lucas-clemente/quic-go v0.28.0
|
||||
# github.com/lucas-clemente/quic-go v0.28.1
|
||||
## explicit; go 1.16
|
||||
github.com/lucas-clemente/quic-go
|
||||
github.com/lucas-clemente/quic-go/http3
|
||||
|
@ -619,7 +619,7 @@ golang.org/x/mod/internal/lazyregexp
|
|||
golang.org/x/mod/modfile
|
||||
golang.org/x/mod/module
|
||||
golang.org/x/mod/semver
|
||||
# golang.org/x/net v0.0.0-20220722155237-a158d28d115b
|
||||
# golang.org/x/net v0.0.0-20220728211354-c7608f3a8462
|
||||
## explicit; go 1.17
|
||||
golang.org/x/net/bpf
|
||||
golang.org/x/net/http/httpguts
|
||||
|
@ -632,7 +632,7 @@ golang.org/x/net/internal/socks
|
|||
golang.org/x/net/ipv4
|
||||
golang.org/x/net/ipv6
|
||||
golang.org/x/net/proxy
|
||||
# golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
|
||||
# golang.org/x/sys v0.0.0-20220731174439-a90be440212d
|
||||
## explicit; go 1.17
|
||||
golang.org/x/sys/cpu
|
||||
golang.org/x/sys/execabs
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue