TUN-5547: Bump golang x/net package to fix http2 transport bugs
This commit is contained in:
parent
97309d81ab
commit
74556bcd7d
2
go.mod
2
go.mod
|
@ -46,7 +46,7 @@ require (
|
||||||
github.com/urfave/cli/v2 v2.2.0
|
github.com/urfave/cli/v2 v2.2.0
|
||||||
go.uber.org/automaxprocs v1.4.0
|
go.uber.org/automaxprocs v1.4.0
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
|
||||||
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508
|
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d
|
||||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
|
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 // indirect
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
|
||||||
|
|
2
go.sum
2
go.sum
|
@ -830,6 +830,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG0
|
||||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||||
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508 h1:v3NKo+t/Kc3EASxaKZ82lwK6mCf4ZeObQBduYFZHo7c=
|
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508 h1:v3NKo+t/Kc3EASxaKZ82lwK6mCf4ZeObQBduYFZHo7c=
|
||||||
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211109214657-ef0fda0de508/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d h1:1n1fc535VhN8SYtD4cDUyNlfpAF2ROMM9+11equK3hs=
|
||||||
|
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
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-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
|
|
@ -1,172 +0,0 @@
|
||||||
// Copyright 2009 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.
|
|
||||||
|
|
||||||
//go:build ignore
|
|
||||||
|
|
||||||
// Generate a self-signed X.509 certificate for a TLS server. Outputs to
|
|
||||||
// 'cert.pem' and 'key.pem' and will overwrite existing files.
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/ecdsa"
|
|
||||||
"crypto/ed25519"
|
|
||||||
"crypto/elliptic"
|
|
||||||
"crypto/rand"
|
|
||||||
"crypto/rsa"
|
|
||||||
"crypto/x509"
|
|
||||||
"crypto/x509/pkix"
|
|
||||||
"encoding/pem"
|
|
||||||
"flag"
|
|
||||||
"log"
|
|
||||||
"math/big"
|
|
||||||
"net"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
host = flag.String("host", "", "Comma-separated hostnames and IPs to generate a certificate for")
|
|
||||||
validFrom = flag.String("start-date", "", "Creation date formatted as Jan 1 15:04:05 2011")
|
|
||||||
validFor = flag.Duration("duration", 365*24*time.Hour, "Duration that certificate is valid for")
|
|
||||||
isCA = flag.Bool("ca", false, "whether this cert should be its own Certificate Authority")
|
|
||||||
rsaBits = flag.Int("rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set")
|
|
||||||
ecdsaCurve = flag.String("ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256 (recommended), P384, P521")
|
|
||||||
ed25519Key = flag.Bool("ed25519", false, "Generate an Ed25519 key")
|
|
||||||
)
|
|
||||||
|
|
||||||
func publicKey(priv any) any {
|
|
||||||
switch k := priv.(type) {
|
|
||||||
case *rsa.PrivateKey:
|
|
||||||
return &k.PublicKey
|
|
||||||
case *ecdsa.PrivateKey:
|
|
||||||
return &k.PublicKey
|
|
||||||
case ed25519.PrivateKey:
|
|
||||||
return k.Public().(ed25519.PublicKey)
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
if len(*host) == 0 {
|
|
||||||
log.Fatalf("Missing required --host parameter")
|
|
||||||
}
|
|
||||||
|
|
||||||
var priv any
|
|
||||||
var err error
|
|
||||||
switch *ecdsaCurve {
|
|
||||||
case "":
|
|
||||||
if *ed25519Key {
|
|
||||||
_, priv, err = ed25519.GenerateKey(rand.Reader)
|
|
||||||
} else {
|
|
||||||
priv, err = rsa.GenerateKey(rand.Reader, *rsaBits)
|
|
||||||
}
|
|
||||||
case "P224":
|
|
||||||
priv, err = ecdsa.GenerateKey(elliptic.P224(), rand.Reader)
|
|
||||||
case "P256":
|
|
||||||
priv, err = ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
|
||||||
case "P384":
|
|
||||||
priv, err = ecdsa.GenerateKey(elliptic.P384(), rand.Reader)
|
|
||||||
case "P521":
|
|
||||||
priv, err = ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
|
|
||||||
default:
|
|
||||||
log.Fatalf("Unrecognized elliptic curve: %q", *ecdsaCurve)
|
|
||||||
}
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to generate private key: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ECDSA, ED25519 and RSA subject keys should have the DigitalSignature
|
|
||||||
// KeyUsage bits set in the x509.Certificate template
|
|
||||||
keyUsage := x509.KeyUsageDigitalSignature
|
|
||||||
// Only RSA subject keys should have the KeyEncipherment KeyUsage bits set. In
|
|
||||||
// the context of TLS this KeyUsage is particular to RSA key exchange and
|
|
||||||
// authentication.
|
|
||||||
if _, isRSA := priv.(*rsa.PrivateKey); isRSA {
|
|
||||||
keyUsage |= x509.KeyUsageKeyEncipherment
|
|
||||||
}
|
|
||||||
|
|
||||||
var notBefore time.Time
|
|
||||||
if len(*validFrom) == 0 {
|
|
||||||
notBefore = time.Now()
|
|
||||||
} else {
|
|
||||||
notBefore, err = time.Parse("Jan 2 15:04:05 2006", *validFrom)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to parse creation date: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
notAfter := notBefore.Add(*validFor)
|
|
||||||
|
|
||||||
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
|
|
||||||
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to generate serial number: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
template := x509.Certificate{
|
|
||||||
SerialNumber: serialNumber,
|
|
||||||
Subject: pkix.Name{
|
|
||||||
Organization: []string{"Acme Co"},
|
|
||||||
},
|
|
||||||
NotBefore: notBefore,
|
|
||||||
NotAfter: notAfter,
|
|
||||||
|
|
||||||
KeyUsage: keyUsage,
|
|
||||||
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
|
|
||||||
BasicConstraintsValid: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
hosts := strings.Split(*host, ",")
|
|
||||||
for _, h := range hosts {
|
|
||||||
if ip := net.ParseIP(h); ip != nil {
|
|
||||||
template.IPAddresses = append(template.IPAddresses, ip)
|
|
||||||
} else {
|
|
||||||
template.DNSNames = append(template.DNSNames, h)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if *isCA {
|
|
||||||
template.IsCA = true
|
|
||||||
template.KeyUsage |= x509.KeyUsageCertSign
|
|
||||||
}
|
|
||||||
|
|
||||||
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, publicKey(priv), priv)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to create certificate: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
certOut, err := os.Create("cert.pem")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to open cert.pem for writing: %v", err)
|
|
||||||
}
|
|
||||||
if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil {
|
|
||||||
log.Fatalf("Failed to write data to cert.pem: %v", err)
|
|
||||||
}
|
|
||||||
if err := certOut.Close(); err != nil {
|
|
||||||
log.Fatalf("Error closing cert.pem: %v", err)
|
|
||||||
}
|
|
||||||
log.Print("wrote cert.pem\n")
|
|
||||||
|
|
||||||
keyOut, err := os.OpenFile("key.pem", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Failed to open key.pem for writing: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
privBytes, err := x509.MarshalPKCS8PrivateKey(priv)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Unable to marshal private key: %v", err)
|
|
||||||
}
|
|
||||||
if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil {
|
|
||||||
log.Fatalf("Failed to write data to key.pem: %v", err)
|
|
||||||
}
|
|
||||||
if err := keyOut.Close(); err != nil {
|
|
||||||
log.Fatalf("Error closing key.pem: %v", err)
|
|
||||||
}
|
|
||||||
log.Print("wrote key.pem\n")
|
|
||||||
}
|
|
|
@ -719,7 +719,15 @@ func (sc *serverConn) canonicalHeader(v string) string {
|
||||||
sc.canonHeader = make(map[string]string)
|
sc.canonHeader = make(map[string]string)
|
||||||
}
|
}
|
||||||
cv = http.CanonicalHeaderKey(v)
|
cv = http.CanonicalHeaderKey(v)
|
||||||
sc.canonHeader[v] = cv
|
// maxCachedCanonicalHeaders is an arbitrarily-chosen limit on the number of
|
||||||
|
// entries in the canonHeader cache. This should be larger than the number
|
||||||
|
// of unique, uncommon header keys likely to be sent by the peer, while not
|
||||||
|
// so high as to permit unreasonable memory usage if the peer sends an unbounded
|
||||||
|
// number of unique header keys.
|
||||||
|
const maxCachedCanonicalHeaders = 32
|
||||||
|
if len(sc.canonHeader) < maxCachedCanonicalHeaders {
|
||||||
|
sc.canonHeader[v] = cv
|
||||||
|
}
|
||||||
return cv
|
return cv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1124,36 +1124,49 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleResponseHeaders := func() (*http.Response, error) {
|
||||||
|
res := cs.res
|
||||||
|
if res.StatusCode > 299 {
|
||||||
|
// On error or status code 3xx, 4xx, 5xx, etc abort any
|
||||||
|
// ongoing write, assuming that the server doesn't care
|
||||||
|
// about our request body. If the server replied with 1xx or
|
||||||
|
// 2xx, however, then assume the server DOES potentially
|
||||||
|
// want our body (e.g. full-duplex streaming:
|
||||||
|
// golang.org/issue/13444). If it turns out the server
|
||||||
|
// doesn't, they'll RST_STREAM us soon enough. This is a
|
||||||
|
// heuristic to avoid adding knobs to Transport. Hopefully
|
||||||
|
// we can keep it.
|
||||||
|
cs.abortRequestBodyWrite()
|
||||||
|
}
|
||||||
|
res.Request = req
|
||||||
|
res.TLS = cc.tlsState
|
||||||
|
if res.Body == noBody && actualContentLength(req) == 0 {
|
||||||
|
// If there isn't a request or response body still being
|
||||||
|
// written, then wait for the stream to be closed before
|
||||||
|
// RoundTrip returns.
|
||||||
|
if err := waitDone(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-cs.respHeaderRecv:
|
case <-cs.respHeaderRecv:
|
||||||
res := cs.res
|
return handleResponseHeaders()
|
||||||
if res.StatusCode > 299 {
|
|
||||||
// On error or status code 3xx, 4xx, 5xx, etc abort any
|
|
||||||
// ongoing write, assuming that the server doesn't care
|
|
||||||
// about our request body. If the server replied with 1xx or
|
|
||||||
// 2xx, however, then assume the server DOES potentially
|
|
||||||
// want our body (e.g. full-duplex streaming:
|
|
||||||
// golang.org/issue/13444). If it turns out the server
|
|
||||||
// doesn't, they'll RST_STREAM us soon enough. This is a
|
|
||||||
// heuristic to avoid adding knobs to Transport. Hopefully
|
|
||||||
// we can keep it.
|
|
||||||
cs.abortRequestBodyWrite()
|
|
||||||
}
|
|
||||||
res.Request = req
|
|
||||||
res.TLS = cc.tlsState
|
|
||||||
if res.Body == noBody && actualContentLength(req) == 0 {
|
|
||||||
// If there isn't a request or response body still being
|
|
||||||
// written, then wait for the stream to be closed before
|
|
||||||
// RoundTrip returns.
|
|
||||||
if err := waitDone(); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return res, nil
|
|
||||||
case <-cs.abort:
|
case <-cs.abort:
|
||||||
waitDone()
|
select {
|
||||||
return nil, cs.abortErr
|
case <-cs.respHeaderRecv:
|
||||||
|
// If both cs.respHeaderRecv and cs.abort are signaling,
|
||||||
|
// pick respHeaderRecv. The server probably wrote the
|
||||||
|
// response and immediately reset the stream.
|
||||||
|
// golang.org/issue/49645
|
||||||
|
return handleResponseHeaders()
|
||||||
|
default:
|
||||||
|
waitDone()
|
||||||
|
return nil, cs.abortErr
|
||||||
|
}
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
err := ctx.Err()
|
err := ctx.Err()
|
||||||
cs.abortStream(err)
|
cs.abortStream(err)
|
||||||
|
@ -1213,6 +1226,9 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cc.addStreamLocked(cs) // assigns stream ID
|
cc.addStreamLocked(cs) // assigns stream ID
|
||||||
|
if isConnectionCloseRequest(req) {
|
||||||
|
cc.doNotReuse = true
|
||||||
|
}
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
|
|
||||||
// TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere?
|
// TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere?
|
||||||
|
@ -1236,12 +1252,12 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
continueTimeout := cc.t.expectContinueTimeout()
|
continueTimeout := cc.t.expectContinueTimeout()
|
||||||
if continueTimeout != 0 &&
|
if continueTimeout != 0 {
|
||||||
!httpguts.HeaderValuesContainsToken(
|
if !httpguts.HeaderValuesContainsToken(req.Header["Expect"], "100-continue") {
|
||||||
req.Header["Expect"],
|
continueTimeout = 0
|
||||||
"100-continue") {
|
} else {
|
||||||
continueTimeout = 0
|
cs.on100 = make(chan struct{}, 1)
|
||||||
cs.on100 = make(chan struct{}, 1)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Past this point (where we send request headers), it is possible for
|
// Past this point (where we send request headers), it is possible for
|
||||||
|
@ -1310,6 +1326,7 @@ func (cs *clientStream) writeRequest(req *http.Request) (err error) {
|
||||||
case <-respHeaderTimer:
|
case <-respHeaderTimer:
|
||||||
return errTimeout
|
return errTimeout
|
||||||
case <-respHeaderRecv:
|
case <-respHeaderRecv:
|
||||||
|
respHeaderRecv = nil
|
||||||
respHeaderTimer = nil // keep waiting for END_STREAM
|
respHeaderTimer = nil // keep waiting for END_STREAM
|
||||||
case <-cs.abort:
|
case <-cs.abort:
|
||||||
return cs.abortErr
|
return cs.abortErr
|
||||||
|
@ -2313,7 +2330,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
|
||||||
cs.bytesRemain = res.ContentLength
|
cs.bytesRemain = res.ContentLength
|
||||||
res.Body = transportResponseBody{cs}
|
res.Body = transportResponseBody{cs}
|
||||||
|
|
||||||
if cs.requestedGzip && res.Header.Get("Content-Encoding") == "gzip" {
|
if cs.requestedGzip && asciiEqualFold(res.Header.Get("Content-Encoding"), "gzip") {
|
||||||
res.Header.Del("Content-Encoding")
|
res.Header.Del("Content-Encoding")
|
||||||
res.Header.Del("Content-Length")
|
res.Header.Del("Content-Length")
|
||||||
res.ContentLength = -1
|
res.ContentLength = -1
|
||||||
|
@ -2452,7 +2469,10 @@ func (b transportResponseBody) Close() error {
|
||||||
select {
|
select {
|
||||||
case <-cs.donec:
|
case <-cs.donec:
|
||||||
case <-cs.ctx.Done():
|
case <-cs.ctx.Done():
|
||||||
return cs.ctx.Err()
|
// See golang/go#49366: The net/http package can cancel the
|
||||||
|
// request context after the response body is fully read.
|
||||||
|
// Don't treat this as an error.
|
||||||
|
return nil
|
||||||
case <-cs.reqCancel:
|
case <-cs.reqCancel:
|
||||||
return errRequestCanceled
|
return errRequestCanceled
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ type WriteScheduler interface {
|
||||||
|
|
||||||
// Pop dequeues the next frame to write. Returns false if no frames can
|
// Pop dequeues the next frame to write. Returns false if no frames can
|
||||||
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
// be written. Frames with a given wr.StreamID() are Pop'd in the same
|
||||||
// order they are Push'd. No frames should be discarded except by CloseStream.
|
// order they are Push'd, except RST_STREAM frames. No frames should be
|
||||||
|
// discarded except by CloseStream.
|
||||||
Pop() (wr FrameWriteRequest, ok bool)
|
Pop() (wr FrameWriteRequest, ok bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +53,7 @@ type FrameWriteRequest struct {
|
||||||
|
|
||||||
// stream is the stream on which this frame will be written.
|
// stream is the stream on which this frame will be written.
|
||||||
// nil for non-stream frames like PING and SETTINGS.
|
// nil for non-stream frames like PING and SETTINGS.
|
||||||
|
// nil for RST_STREAM streams, which use the StreamError.StreamID field instead.
|
||||||
stream *stream
|
stream *stream
|
||||||
|
|
||||||
// done, if non-nil, must be a buffered channel with space for
|
// done, if non-nil, must be a buffered channel with space for
|
||||||
|
|
|
@ -45,11 +45,11 @@ func (ws *randomWriteScheduler) AdjustStream(streamID uint32, priority PriorityP
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) {
|
func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) {
|
||||||
id := wr.StreamID()
|
if wr.isControl() {
|
||||||
if id == 0 {
|
|
||||||
ws.zero.push(wr)
|
ws.zero.push(wr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
id := wr.StreamID()
|
||||||
q, ok := ws.sq[id]
|
q, ok := ws.sq[id]
|
||||||
if !ok {
|
if !ok {
|
||||||
q = ws.queuePool.get()
|
q = ws.queuePool.get()
|
||||||
|
@ -59,7 +59,7 @@ func (ws *randomWriteScheduler) Push(wr FrameWriteRequest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) {
|
func (ws *randomWriteScheduler) Pop() (FrameWriteRequest, bool) {
|
||||||
// Control frames first.
|
// Control and RST_STREAM frames first.
|
||||||
if !ws.zero.empty() {
|
if !ws.zero.empty() {
|
||||||
return ws.zero.shift(), true
|
return ws.zero.shift(), true
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
||||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
|
@ -2,6 +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.
|
||||||
|
|
||||||
|
//go:build darwin && go1.12
|
||||||
// +build darwin,go1.12
|
// +build darwin,go1.12
|
||||||
|
|
||||||
// This exists solely so we can linkname in symbols from syscall.
|
// This exists solely so we can linkname in symbols from syscall.
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos)
|
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || zos)
|
||||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd zos
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd zos
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
//go:build (arm64 || amd64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
//go:build (arm64 || amd64 || loong64 || ppc64 || ppc64le || mips64 || mips64le || riscv64 || s390x) && linux
|
||||||
// +build arm64 amd64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
// +build arm64 amd64 loong64 ppc64 ppc64le mips64 mips64le riscv64 s390x
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || openbsd
|
//go:build aix || darwin || dragonfly || freebsd || openbsd || solaris
|
||||||
// +build aix darwin dragonfly freebsd openbsd
|
// +build aix darwin dragonfly freebsd openbsd solaris
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
// Copyright 2018 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.
|
|
||||||
|
|
||||||
//go:build aix || (go1.12 && darwin)
|
|
||||||
// +build aix go1.12,darwin
|
|
||||||
|
|
||||||
package socket
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:linkname syscall_getsockopt syscall.getsockopt
|
|
||||||
func syscall_getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *uint32) 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)
|
|
||||||
return int(l), err
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:linkname syscall_setsockopt syscall.setsockopt
|
|
||||||
func syscall_setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error
|
|
||||||
|
|
||||||
func setsockopt(s uintptr, level, name int, b []byte) error {
|
|
||||||
return syscall_setsockopt(int(s), level, name, unsafe.Pointer(&b[0]), uintptr(len(b)))
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:linkname syscall_recvmsg syscall.recvmsg
|
|
||||||
func syscall_recvmsg(s int, msg *syscall.Msghdr, flags int) (n int, err error)
|
|
||||||
|
|
||||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
return syscall_recvmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
//go:linkname syscall_sendmsg syscall.sendmsg
|
|
||||||
func syscall_sendmsg(s int, msg *syscall.Msghdr, flags int) (n int, err error)
|
|
||||||
|
|
||||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
return syscall_sendmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags)
|
|
||||||
}
|
|
|
@ -10,38 +10,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sysSETSOCKOPT = 0xe
|
sysRECVMMSG = 0x13
|
||||||
sysGETSOCKOPT = 0xf
|
sysSENDMMSG = 0x14
|
||||||
sysSENDMSG = 0x10
|
|
||||||
sysRECVMSG = 0x11
|
|
||||||
sysRECVMMSG = 0x13
|
|
||||||
sysSENDMMSG = 0x14
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
||||||
func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
||||||
|
|
||||||
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
|
|
||||||
l := uint32(len(b))
|
|
||||||
_, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0)
|
|
||||||
return int(l), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func setsockopt(s uintptr, level, name int, b []byte) error {
|
|
||||||
_, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0)
|
|
||||||
return errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
n, errno := socketcall(sysRECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0)
|
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
n, errno := socketcall(sysSENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0)
|
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
|
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
|
||||||
n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
|
n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
|
||||||
return int(n), errnoErr(errno)
|
return int(n), errnoErr(errno)
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
// Copyright 2021 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.
|
||||||
|
|
||||||
|
//go:build loong64
|
||||||
|
// +build loong64
|
||||||
|
|
||||||
|
package socket
|
||||||
|
|
||||||
|
const (
|
||||||
|
sysRECVMMSG = 0xf3
|
||||||
|
sysSENDMMSG = 0x10d
|
||||||
|
)
|
|
@ -10,38 +10,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
sysSETSOCKOPT = 0xe
|
sysRECVMMSG = 0x13
|
||||||
sysGETSOCKOPT = 0xf
|
sysSENDMMSG = 0x14
|
||||||
sysSENDMSG = 0x10
|
|
||||||
sysRECVMSG = 0x11
|
|
||||||
sysRECVMMSG = 0x13
|
|
||||||
sysSENDMMSG = 0x14
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
func socketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
||||||
func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
func rawsocketcall(call, a0, a1, a2, a3, a4, a5 uintptr) (uintptr, syscall.Errno)
|
||||||
|
|
||||||
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
|
|
||||||
l := uint32(len(b))
|
|
||||||
_, errno := socketcall(sysGETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0)
|
|
||||||
return int(l), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func setsockopt(s uintptr, level, name int, b []byte) error {
|
|
||||||
_, errno := socketcall(sysSETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0)
|
|
||||||
return errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
n, errno := socketcall(sysRECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0)
|
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
n, errno := socketcall(sysSENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0)
|
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
|
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
|
||||||
n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
|
n, errno := socketcall(sysRECVMMSG, s, uintptr(unsafe.Pointer(&hs[0])), uintptr(len(hs)), uintptr(flags), 0, 0)
|
||||||
return int(n), errnoErr(errno)
|
return int(n), errnoErr(errno)
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
// Copyright 2017 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.
|
|
||||||
|
|
||||||
package socket
|
|
||||||
|
|
||||||
import (
|
|
||||||
"syscall"
|
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc___xnet_getsockopt __xnet_getsockopt "libsocket.so"
|
|
||||||
//go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so"
|
|
||||||
//go:cgo_import_dynamic libc___xnet_recvmsg __xnet_recvmsg "libsocket.so"
|
|
||||||
//go:cgo_import_dynamic libc___xnet_sendmsg __xnet_sendmsg "libsocket.so"
|
|
||||||
|
|
||||||
//go:linkname procGetsockopt libc___xnet_getsockopt
|
|
||||||
//go:linkname procSetsockopt libc_setsockopt
|
|
||||||
//go:linkname procRecvmsg libc___xnet_recvmsg
|
|
||||||
//go:linkname procSendmsg libc___xnet_sendmsg
|
|
||||||
|
|
||||||
var (
|
|
||||||
procGetsockopt uintptr
|
|
||||||
procSetsockopt uintptr
|
|
||||||
procRecvmsg uintptr
|
|
||||||
procSendmsg uintptr
|
|
||||||
)
|
|
||||||
|
|
||||||
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno)
|
|
||||||
func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (uintptr, uintptr, syscall.Errno)
|
|
||||||
|
|
||||||
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
|
|
||||||
l := uint32(len(b))
|
|
||||||
_, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procGetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0)
|
|
||||||
return int(l), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func setsockopt(s uintptr, level, name int, b []byte) error {
|
|
||||||
_, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procSetsockopt)), 5, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0)
|
|
||||||
return errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
n, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procRecvmsg)), 3, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0)
|
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
|
||||||
n, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procSendmsg)), 3, s, uintptr(unsafe.Pointer(h)), uintptr(flags), 0, 0, 0)
|
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
|
||||||
|
|
||||||
func recvmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
|
|
||||||
return 0, errNotImplemented
|
|
||||||
}
|
|
||||||
|
|
||||||
func sendmmsg(s uintptr, hs []mmsghdr, flags int) (int, error) {
|
|
||||||
return 0, errNotImplemented
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
// Copyright 2016 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.
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
TEXT ·sysvicall6(SB),NOSPLIT,$0-88
|
|
||||||
JMP syscall·sysvicall6(SB)
|
|
||||||
|
|
||||||
TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
|
|
||||||
JMP syscall·rawSysvicall6(SB)
|
|
|
@ -2,8 +2,8 @@
|
||||||
// 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.
|
||||||
|
|
||||||
//go:build dragonfly || freebsd || (linux && !s390x && !386) || netbsd || openbsd
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
||||||
// +build dragonfly freebsd linux,!s390x,!386 netbsd openbsd
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package socket
|
package socket
|
||||||
|
|
||||||
|
@ -12,23 +12,32 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:linkname syscall_getsockopt syscall.getsockopt
|
||||||
|
func syscall_getsockopt(s, level, name int, val unsafe.Pointer, vallen *uint32) error
|
||||||
|
|
||||||
|
//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) {
|
func getsockopt(s uintptr, level, name int, b []byte) (int, error) {
|
||||||
l := uint32(len(b))
|
l := uint32(len(b))
|
||||||
_, _, errno := syscall.Syscall6(syscall.SYS_GETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(unsafe.Pointer(&l)), 0)
|
err := syscall_getsockopt(int(s), level, name, unsafe.Pointer(&b[0]), &l)
|
||||||
return int(l), errnoErr(errno)
|
return int(l), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func setsockopt(s uintptr, level, name int, b []byte) error {
|
func setsockopt(s uintptr, level, name int, b []byte) error {
|
||||||
_, _, errno := syscall.Syscall6(syscall.SYS_SETSOCKOPT, s, uintptr(level), uintptr(name), uintptr(unsafe.Pointer(&b[0])), uintptr(len(b)), 0)
|
return syscall_setsockopt(int(s), level, name, unsafe.Pointer(&b[0]), uintptr(len(b)))
|
||||||
return errnoErr(errno)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
func recvmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||||
n, _, errno := syscall.Syscall(syscall.SYS_RECVMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags))
|
return syscall_recvmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags)
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
func sendmsg(s uintptr, h *msghdr, flags int) (int, error) {
|
||||||
n, _, errno := syscall.Syscall(syscall.SYS_SENDMSG, s, uintptr(unsafe.Pointer(h)), uintptr(flags))
|
return syscall_sendmsg(int(s), (*syscall.Msghdr)(unsafe.Pointer(h)), flags)
|
||||||
return int(n), errnoErr(errno)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
|
//go:build loong64
|
||||||
|
// +build loong64
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
sizeofIovec = 0x10
|
||||||
|
sizeofMsghdr = 0x38
|
||||||
|
)
|
|
@ -0,0 +1,77 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
|
//go:build loong64
|
||||||
|
// +build loong64
|
||||||
|
|
||||||
|
package ipv4
|
||||||
|
|
||||||
|
const (
|
||||||
|
sizeofKernelSockaddrStorage = 0x80
|
||||||
|
sizeofSockaddrInet = 0x10
|
||||||
|
sizeofInetPktinfo = 0xc
|
||||||
|
sizeofSockExtendedErr = 0x10
|
||||||
|
|
||||||
|
sizeofIPMreq = 0x8
|
||||||
|
sizeofIPMreqSource = 0xc
|
||||||
|
sizeofGroupReq = 0x88
|
||||||
|
sizeofGroupSourceReq = 0x108
|
||||||
|
|
||||||
|
sizeofICMPFilter = 0x4
|
||||||
|
)
|
||||||
|
|
||||||
|
type kernelSockaddrStorage struct {
|
||||||
|
Family uint16
|
||||||
|
X__data [126]int8
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet struct {
|
||||||
|
Family uint16
|
||||||
|
Port uint16
|
||||||
|
Addr [4]byte /* in_addr */
|
||||||
|
X__pad [8]uint8
|
||||||
|
}
|
||||||
|
|
||||||
|
type inetPktinfo struct {
|
||||||
|
Ifindex int32
|
||||||
|
Spec_dst [4]byte /* in_addr */
|
||||||
|
Addr [4]byte /* in_addr */
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockExtendedErr struct {
|
||||||
|
Errno uint32
|
||||||
|
Origin uint8
|
||||||
|
Type uint8
|
||||||
|
Code uint8
|
||||||
|
Pad uint8
|
||||||
|
Info uint32
|
||||||
|
Data uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipMreq struct {
|
||||||
|
Multiaddr [4]byte /* in_addr */
|
||||||
|
Interface [4]byte /* in_addr */
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipMreqSource struct {
|
||||||
|
Multiaddr uint32
|
||||||
|
Interface uint32
|
||||||
|
Sourceaddr uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Pad_cgo_0 [4]byte
|
||||||
|
Group kernelSockaddrStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupSourceReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Pad_cgo_0 [4]byte
|
||||||
|
Group kernelSockaddrStorage
|
||||||
|
Source kernelSockaddrStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
type icmpFilter struct {
|
||||||
|
Data uint32
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||||
|
// cgo -godefs defs_linux.go
|
||||||
|
|
||||||
|
//go:build loong64
|
||||||
|
// +build loong64
|
||||||
|
|
||||||
|
package ipv6
|
||||||
|
|
||||||
|
const (
|
||||||
|
sizeofKernelSockaddrStorage = 0x80
|
||||||
|
sizeofSockaddrInet6 = 0x1c
|
||||||
|
sizeofInet6Pktinfo = 0x14
|
||||||
|
sizeofIPv6Mtuinfo = 0x20
|
||||||
|
sizeofIPv6FlowlabelReq = 0x20
|
||||||
|
|
||||||
|
sizeofIPv6Mreq = 0x14
|
||||||
|
sizeofGroupReq = 0x88
|
||||||
|
sizeofGroupSourceReq = 0x108
|
||||||
|
|
||||||
|
sizeofICMPv6Filter = 0x20
|
||||||
|
)
|
||||||
|
|
||||||
|
type kernelSockaddrStorage struct {
|
||||||
|
Family uint16
|
||||||
|
X__data [126]int8
|
||||||
|
}
|
||||||
|
|
||||||
|
type sockaddrInet6 struct {
|
||||||
|
Family uint16
|
||||||
|
Port uint16
|
||||||
|
Flowinfo uint32
|
||||||
|
Addr [16]byte /* in6_addr */
|
||||||
|
Scope_id uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type inet6Pktinfo struct {
|
||||||
|
Addr [16]byte /* in6_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipv6Mtuinfo struct {
|
||||||
|
Addr sockaddrInet6
|
||||||
|
Mtu uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipv6FlowlabelReq struct {
|
||||||
|
Dst [16]byte /* in6_addr */
|
||||||
|
Label uint32
|
||||||
|
Action uint8
|
||||||
|
Share uint8
|
||||||
|
Flags uint16
|
||||||
|
Expires uint16
|
||||||
|
Linger uint16
|
||||||
|
X__flr_pad uint32
|
||||||
|
}
|
||||||
|
|
||||||
|
type ipv6Mreq struct {
|
||||||
|
Multiaddr [16]byte /* in6_addr */
|
||||||
|
Ifindex int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Pad_cgo_0 [4]byte
|
||||||
|
Group kernelSockaddrStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
type groupSourceReq struct {
|
||||||
|
Interface uint32
|
||||||
|
Pad_cgo_0 [4]byte
|
||||||
|
Group kernelSockaddrStorage
|
||||||
|
Source kernelSockaddrStorage
|
||||||
|
}
|
||||||
|
|
||||||
|
type icmpv6Filter struct {
|
||||||
|
Data [8]uint32
|
||||||
|
}
|
|
@ -367,7 +367,7 @@ golang.org/x/crypto/ssh/terminal
|
||||||
## explicit; go 1.12
|
## explicit; go 1.12
|
||||||
golang.org/x/mod/module
|
golang.org/x/mod/module
|
||||||
golang.org/x/mod/semver
|
golang.org/x/mod/semver
|
||||||
# golang.org/x/net v0.0.0-20211109214657-ef0fda0de508
|
# golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
golang.org/x/net/bpf
|
golang.org/x/net/bpf
|
||||||
golang.org/x/net/context
|
golang.org/x/net/context
|
||||||
|
|
Loading…
Reference in New Issue