update golang.org/x dependencies

This commit is contained in:
Mechiel Lukkien 2025-03-28 16:23:28 +01:00
parent 027e5754a0
commit 8b418a9ca2
No known key found for this signature in database
83 changed files with 2385 additions and 1185 deletions

14
go.mod
View File

@ -15,10 +15,10 @@ require (
github.com/prometheus/client_golang v1.18.0 github.com/prometheus/client_golang v1.18.0
github.com/russross/blackfriday/v2 v2.1.0 github.com/russross/blackfriday/v2 v2.1.0
go.etcd.io/bbolt v1.3.11 go.etcd.io/bbolt v1.3.11
golang.org/x/crypto v0.32.0 golang.org/x/crypto v0.36.0
golang.org/x/net v0.34.0 golang.org/x/net v0.38.0
golang.org/x/sys v0.29.0 golang.org/x/sys v0.31.0
golang.org/x/text v0.21.0 golang.org/x/text v0.23.0
rsc.io/qr v0.2.0 rsc.io/qr v0.2.0
) )
@ -30,8 +30,8 @@ require (
github.com/prometheus/client_model v0.5.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect
golang.org/x/mod v0.22.0 // indirect golang.org/x/mod v0.24.0 // indirect
golang.org/x/sync v0.10.0 // indirect golang.org/x/sync v0.12.0 // indirect
golang.org/x/tools v0.29.0 // indirect golang.org/x/tools v0.31.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect google.golang.org/protobuf v1.31.0 // indirect
) )

28
go.sum
View File

@ -75,33 +75,33 @@ go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.29.0 h1:Xx0h3TtM9rzQpQuR4dKLrdglAmCEN5Oi+P74JdhdzXE= golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
golang.org/x/tools v0.29.0/go.mod h1:KMQVMRsVxU6nHCFXrBPhDB8XncLNLM0lIy/F14RP588= golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -514,7 +514,11 @@ func (c *Client) Accept(ctx context.Context, chal *Challenge) (*Challenge, error
return nil, err return nil, err
} }
res, err := c.post(ctx, nil, chal.URI, json.RawMessage("{}"), wantStatus( payload := json.RawMessage("{}")
if len(chal.Payload) != 0 {
payload = chal.Payload
}
res, err := c.post(ctx, nil, chal.URI, payload, wantStatus(
http.StatusOK, // according to the spec http.StatusOK, // according to the spec
http.StatusAccepted, // Let's Encrypt: see https://goo.gl/WsJ7VT (acme-divergences.md) http.StatusAccepted, // Let's Encrypt: see https://goo.gl/WsJ7VT (acme-divergences.md)
)) ))

View File

@ -7,6 +7,7 @@ package acme
import ( import (
"crypto" "crypto"
"crypto/x509" "crypto/x509"
"encoding/json"
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
@ -527,6 +528,16 @@ type Challenge struct {
// when this challenge was used. // when this challenge was used.
// The type of a non-nil value is *Error. // The type of a non-nil value is *Error.
Error error Error error
// Payload is the JSON-formatted payload that the client sends
// to the server to indicate it is ready to respond to the challenge.
// When unset, it defaults to an empty JSON object: {}.
// For most challenges, the client must not set Payload,
// see https://tools.ietf.org/html/rfc8555#section-7.5.1.
// Payload is used only for newer challenges (such as "device-attest-01")
// where the client must send additional data for the server to validate
// the challenge.
Payload json.RawMessage
} }
// wireChallenge is ACME JSON challenge representation. // wireChallenge is ACME JSON challenge representation.

View File

@ -877,6 +877,11 @@ func (in *input) parseLineBlock(start Position, token []string, lparen token) *L
in.Error(fmt.Sprintf("syntax error (unterminated block started at %s:%d:%d)", in.filename, x.Start.Line, x.Start.LineRune)) in.Error(fmt.Sprintf("syntax error (unterminated block started at %s:%d:%d)", in.filename, x.Start.Line, x.Start.LineRune))
case ')': case ')':
rparen := in.lex() rparen := in.lex()
// Don't preserve blank lines (denoted by a single empty comment, added above)
// at the end of the block.
if len(comments) == 1 && comments[0] == (Comment{}) {
comments = nil
}
x.RParen.Before = comments x.RParen.Before = comments
x.RParen.Pos = rparen.pos x.RParen.Pos = rparen.pos
if !in.peek().isEOL() { if !in.peek().isEOL() {

File diff suppressed because it is too large Load Diff

View File

@ -924,7 +924,7 @@ func inBodyIM(p *parser) bool {
p.addElement() p.addElement()
p.im = inFramesetIM p.im = inFramesetIM
return true return true
case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Main, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul: case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Main, a.Menu, a.Nav, a.Ol, a.P, a.Search, a.Section, a.Summary, a.Ul:
p.popUntil(buttonScope, a.P) p.popUntil(buttonScope, a.P)
p.addElement() p.addElement()
case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6: case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6:
@ -1136,7 +1136,7 @@ func inBodyIM(p *parser) bool {
return false return false
} }
return true return true
case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul: case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Summary, a.Ul:
p.popUntil(defaultScope, p.tok.DataAtom) p.popUntil(defaultScope, p.tok.DataAtom)
case a.Form: case a.Form:
if p.oe.contains(a.Template) { if p.oe.contains(a.Template) {

View File

@ -839,8 +839,22 @@ func (z *Tokenizer) readStartTag() TokenType {
if raw { if raw {
z.rawTag = strings.ToLower(string(z.buf[z.data.start:z.data.end])) z.rawTag = strings.ToLower(string(z.buf[z.data.start:z.data.end]))
} }
// Look for a self-closing token like "<br/>". // Look for a self-closing token (e.g. <br/>).
if z.err == nil && z.buf[z.raw.end-2] == '/' { //
// Originally, we did this by just checking that the last character of the
// tag (ignoring the closing bracket) was a solidus (/) character, but this
// is not always accurate.
//
// We need to be careful that we don't misinterpret a non-self-closing tag
// as self-closing, as can happen if the tag contains unquoted attribute
// values (i.e. <p a=/>).
//
// To avoid this, we check that the last non-bracket character of the tag
// (z.raw.end-2) isn't the same character as the last non-quote character of
// the last attribute of the tag (z.pendingAttr[1].end-1), if the tag has
// attributes.
nAttrs := len(z.attr)
if z.err == nil && z.buf[z.raw.end-2] == '/' && (nAttrs == 0 || z.raw.end-2 != z.attr[nAttrs-1][1].end-1) {
return SelfClosingTagToken return SelfClosingTagToken
} }
return StartTagToken return StartTagToken

View File

@ -225,6 +225,11 @@ var fhBytes = sync.Pool{
}, },
} }
func invalidHTTP1LookingFrameHeader() FrameHeader {
fh, _ := readFrameHeader(make([]byte, frameHeaderLen), strings.NewReader("HTTP/1.1 "))
return fh
}
// ReadFrameHeader reads 9 bytes from r and returns a FrameHeader. // ReadFrameHeader reads 9 bytes from r and returns a FrameHeader.
// Most users should use Framer.ReadFrame instead. // Most users should use Framer.ReadFrame instead.
func ReadFrameHeader(r io.Reader) (FrameHeader, error) { func ReadFrameHeader(r io.Reader) (FrameHeader, error) {
@ -503,10 +508,16 @@ func (fr *Framer) ReadFrame() (Frame, error) {
return nil, err return nil, err
} }
if fh.Length > fr.maxReadSize { if fh.Length > fr.maxReadSize {
if fh == invalidHTTP1LookingFrameHeader() {
return nil, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", err)
}
return nil, ErrFrameTooLarge return nil, ErrFrameTooLarge
} }
payload := fr.getReadBuf(fh.Length) payload := fr.getReadBuf(fh.Length)
if _, err := io.ReadFull(fr.r, payload); err != nil { if _, err := io.ReadFull(fr.r, payload); err != nil {
if fh == invalidHTTP1LookingFrameHeader() {
return nil, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", err)
}
return nil, err return nil, err
} }
f, err := typeFrameParser(fh.Type)(fr.frameCache, fh, fr.countError, payload) f, err := typeFrameParser(fh.Type)(fr.frameCache, fh, fr.countError, payload)

View File

@ -38,7 +38,15 @@ var (
logFrameWrites bool logFrameWrites bool
logFrameReads bool logFrameReads bool
inTests bool inTests bool
disableExtendedConnectProtocol bool
// Enabling extended CONNECT by causes browsers to attempt to use
// WebSockets-over-HTTP/2. This results in problems when the server's websocket
// package doesn't support extended CONNECT.
//
// Disable extended CONNECT by default for now.
//
// Issue #71128.
disableExtendedConnectProtocol = true
) )
func init() { func init() {
@ -51,8 +59,8 @@ func init() {
logFrameWrites = true logFrameWrites = true
logFrameReads = true logFrameReads = true
} }
if strings.Contains(e, "http2xconnect=0") { if strings.Contains(e, "http2xconnect=1") {
disableExtendedConnectProtocol = true disableExtendedConnectProtocol = false
} }
} }
@ -407,23 +415,6 @@ func (s *sorter) SortStrings(ss []string) {
s.v = save s.v = save
} }
// validPseudoPath reports whether v is a valid :path pseudo-header
// value. It must be either:
//
// - a non-empty string starting with '/'
// - the string '*', for OPTIONS requests.
//
// For now this is only used a quick check for deciding when to clean
// up Opaque URLs before sending requests from the Transport.
// See golang.org/issue/16847
//
// We used to enforce that the path also didn't start with "//", but
// Google's GFE accepts such paths and Chrome sends them, so ignore
// that part of the spec. See golang.org/issue/19103.
func validPseudoPath(v string) bool {
return (len(v) > 0 && v[0] == '/') || v == "*"
}
// incomparable is a zero-width, non-comparable type. Adding it to a struct // incomparable is a zero-width, non-comparable type. Adding it to a struct
// makes that struct also non-comparable, and generally doesn't add // makes that struct also non-comparable, and generally doesn't add
// any size (as long as it's first). // any size (as long as it's first).

View File

@ -50,6 +50,7 @@ import (
"golang.org/x/net/http/httpguts" "golang.org/x/net/http/httpguts"
"golang.org/x/net/http2/hpack" "golang.org/x/net/http2/hpack"
"golang.org/x/net/internal/httpcommon"
) )
const ( const (
@ -812,8 +813,7 @@ const maxCachedCanonicalHeadersKeysSize = 2048
func (sc *serverConn) canonicalHeader(v string) string { func (sc *serverConn) canonicalHeader(v string) string {
sc.serveG.check() sc.serveG.check()
buildCommonHeaderMapsOnce() cv, ok := httpcommon.CachedCanonicalHeader(v)
cv, ok := commonCanonHeader[v]
if ok { if ok {
return cv return cv
} }
@ -1068,7 +1068,10 @@ func (sc *serverConn) serve(conf http2Config) {
func (sc *serverConn) handlePingTimer(lastFrameReadTime time.Time) { func (sc *serverConn) handlePingTimer(lastFrameReadTime time.Time) {
if sc.pingSent { if sc.pingSent {
sc.vlogf("timeout waiting for PING response") sc.logf("timeout waiting for PING response")
if f := sc.countErrorFunc; f != nil {
f("conn_close_lost_ping")
}
sc.conn.Close() sc.conn.Close()
return return
} }
@ -2233,25 +2236,25 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream
func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*responseWriter, *http.Request, error) { func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*responseWriter, *http.Request, error) {
sc.serveG.check() sc.serveG.check()
rp := requestParam{ rp := httpcommon.ServerRequestParam{
method: f.PseudoValue("method"), Method: f.PseudoValue("method"),
scheme: f.PseudoValue("scheme"), Scheme: f.PseudoValue("scheme"),
authority: f.PseudoValue("authority"), Authority: f.PseudoValue("authority"),
path: f.PseudoValue("path"), Path: f.PseudoValue("path"),
protocol: f.PseudoValue("protocol"), Protocol: f.PseudoValue("protocol"),
} }
// extended connect is disabled, so we should not see :protocol // extended connect is disabled, so we should not see :protocol
if disableExtendedConnectProtocol && rp.protocol != "" { if disableExtendedConnectProtocol && rp.Protocol != "" {
return nil, nil, sc.countError("bad_connect", streamError(f.StreamID, ErrCodeProtocol)) return nil, nil, sc.countError("bad_connect", streamError(f.StreamID, ErrCodeProtocol))
} }
isConnect := rp.method == "CONNECT" isConnect := rp.Method == "CONNECT"
if isConnect { if isConnect {
if rp.protocol == "" && (rp.path != "" || rp.scheme != "" || rp.authority == "") { if rp.Protocol == "" && (rp.Path != "" || rp.Scheme != "" || rp.Authority == "") {
return nil, nil, sc.countError("bad_connect", streamError(f.StreamID, ErrCodeProtocol)) return nil, nil, sc.countError("bad_connect", streamError(f.StreamID, ErrCodeProtocol))
} }
} else if rp.method == "" || rp.path == "" || (rp.scheme != "https" && rp.scheme != "http") { } else if rp.Method == "" || rp.Path == "" || (rp.Scheme != "https" && rp.Scheme != "http") {
// See 8.1.2.6 Malformed Requests and Responses: // See 8.1.2.6 Malformed Requests and Responses:
// //
// Malformed requests or responses that are detected // Malformed requests or responses that are detected
@ -2265,15 +2268,16 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res
return nil, nil, sc.countError("bad_path_method", streamError(f.StreamID, ErrCodeProtocol)) return nil, nil, sc.countError("bad_path_method", streamError(f.StreamID, ErrCodeProtocol))
} }
rp.header = make(http.Header) header := make(http.Header)
rp.Header = header
for _, hf := range f.RegularFields() { for _, hf := range f.RegularFields() {
rp.header.Add(sc.canonicalHeader(hf.Name), hf.Value) header.Add(sc.canonicalHeader(hf.Name), hf.Value)
} }
if rp.authority == "" { if rp.Authority == "" {
rp.authority = rp.header.Get("Host") rp.Authority = header.Get("Host")
} }
if rp.protocol != "" { if rp.Protocol != "" {
rp.header.Set(":protocol", rp.protocol) header.Set(":protocol", rp.Protocol)
} }
rw, req, err := sc.newWriterAndRequestNoBody(st, rp) rw, req, err := sc.newWriterAndRequestNoBody(st, rp)
@ -2282,7 +2286,7 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res
} }
bodyOpen := !f.StreamEnded() bodyOpen := !f.StreamEnded()
if bodyOpen { if bodyOpen {
if vv, ok := rp.header["Content-Length"]; ok { if vv, ok := rp.Header["Content-Length"]; ok {
if cl, err := strconv.ParseUint(vv[0], 10, 63); err == nil { if cl, err := strconv.ParseUint(vv[0], 10, 63); err == nil {
req.ContentLength = int64(cl) req.ContentLength = int64(cl)
} else { } else {
@ -2298,84 +2302,38 @@ func (sc *serverConn) newWriterAndRequest(st *stream, f *MetaHeadersFrame) (*res
return rw, req, nil return rw, req, nil
} }
type requestParam struct { func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp httpcommon.ServerRequestParam) (*responseWriter, *http.Request, error) {
method string
scheme, authority, path string
protocol string
header http.Header
}
func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*responseWriter, *http.Request, error) {
sc.serveG.check() sc.serveG.check()
var tlsState *tls.ConnectionState // nil if not scheme https var tlsState *tls.ConnectionState // nil if not scheme https
if rp.scheme == "https" { if rp.Scheme == "https" {
tlsState = sc.tlsState tlsState = sc.tlsState
} }
needsContinue := httpguts.HeaderValuesContainsToken(rp.header["Expect"], "100-continue") res := httpcommon.NewServerRequest(rp)
if needsContinue { if res.InvalidReason != "" {
rp.header.Del("Expect") return nil, nil, sc.countError(res.InvalidReason, streamError(st.id, ErrCodeProtocol))
}
// Merge Cookie headers into one "; "-delimited value.
if cookies := rp.header["Cookie"]; len(cookies) > 1 {
rp.header.Set("Cookie", strings.Join(cookies, "; "))
}
// Setup Trailers
var trailer http.Header
for _, v := range rp.header["Trailer"] {
for _, key := range strings.Split(v, ",") {
key = http.CanonicalHeaderKey(textproto.TrimString(key))
switch key {
case "Transfer-Encoding", "Trailer", "Content-Length":
// Bogus. (copy of http1 rules)
// Ignore.
default:
if trailer == nil {
trailer = make(http.Header)
}
trailer[key] = nil
}
}
}
delete(rp.header, "Trailer")
var url_ *url.URL
var requestURI string
if rp.method == "CONNECT" && rp.protocol == "" {
url_ = &url.URL{Host: rp.authority}
requestURI = rp.authority // mimic HTTP/1 server behavior
} else {
var err error
url_, err = url.ParseRequestURI(rp.path)
if err != nil {
return nil, nil, sc.countError("bad_path", streamError(st.id, ErrCodeProtocol))
}
requestURI = rp.path
} }
body := &requestBody{ body := &requestBody{
conn: sc, conn: sc,
stream: st, stream: st,
needsContinue: needsContinue, needsContinue: res.NeedsContinue,
} }
req := &http.Request{ req := (&http.Request{
Method: rp.method, Method: rp.Method,
URL: url_, URL: res.URL,
RemoteAddr: sc.remoteAddrStr, RemoteAddr: sc.remoteAddrStr,
Header: rp.header, Header: rp.Header,
RequestURI: requestURI, RequestURI: res.RequestURI,
Proto: "HTTP/2.0", Proto: "HTTP/2.0",
ProtoMajor: 2, ProtoMajor: 2,
ProtoMinor: 0, ProtoMinor: 0,
TLS: tlsState, TLS: tlsState,
Host: rp.authority, Host: rp.Authority,
Body: body, Body: body,
Trailer: trailer, Trailer: res.Trailer,
} }).WithContext(st.ctx)
req = req.WithContext(st.ctx)
rw := sc.newResponseWriter(st, req) rw := sc.newResponseWriter(st, req)
return rw, req, nil return rw, req, nil
} }
@ -3270,12 +3228,12 @@ func (sc *serverConn) startPush(msg *startPushRequest) {
// we start in "half closed (remote)" for simplicity. // we start in "half closed (remote)" for simplicity.
// See further comments at the definition of stateHalfClosedRemote. // See further comments at the definition of stateHalfClosedRemote.
promised := sc.newStream(promisedID, msg.parent.id, stateHalfClosedRemote) promised := sc.newStream(promisedID, msg.parent.id, stateHalfClosedRemote)
rw, req, err := sc.newWriterAndRequestNoBody(promised, requestParam{ rw, req, err := sc.newWriterAndRequestNoBody(promised, httpcommon.ServerRequestParam{
method: msg.method, Method: msg.method,
scheme: msg.url.Scheme, Scheme: msg.url.Scheme,
authority: msg.url.Host, Authority: msg.url.Host,
path: msg.url.RequestURI(), Path: msg.url.RequestURI(),
header: cloneHeader(msg.header), // clone since handler runs concurrently with writing the PUSH_PROMISE Header: cloneHeader(msg.header), // clone since handler runs concurrently with writing the PUSH_PROMISE
}) })
if err != nil { if err != nil {
// Should not happen, since we've already validated msg.url. // Should not happen, since we've already validated msg.url.

View File

@ -25,7 +25,6 @@ import (
"net/http" "net/http"
"net/http/httptrace" "net/http/httptrace"
"net/textproto" "net/textproto"
"sort"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
@ -35,6 +34,7 @@ import (
"golang.org/x/net/http/httpguts" "golang.org/x/net/http/httpguts"
"golang.org/x/net/http2/hpack" "golang.org/x/net/http2/hpack"
"golang.org/x/net/idna" "golang.org/x/net/idna"
"golang.org/x/net/internal/httpcommon"
) )
const ( const (
@ -1275,23 +1275,6 @@ func (cc *ClientConn) closeForLostPing() {
// exported. At least they'll be DeepEqual for h1-vs-h2 comparisons tests. // exported. At least they'll be DeepEqual for h1-vs-h2 comparisons tests.
var errRequestCanceled = errors.New("net/http: request canceled") var errRequestCanceled = errors.New("net/http: request canceled")
func commaSeparatedTrailers(req *http.Request) (string, error) {
keys := make([]string, 0, len(req.Trailer))
for k := range req.Trailer {
k = canonicalHeader(k)
switch k {
case "Transfer-Encoding", "Trailer", "Content-Length":
return "", fmt.Errorf("invalid Trailer key %q", k)
}
keys = append(keys, k)
}
if len(keys) > 0 {
sort.Strings(keys)
return strings.Join(keys, ","), nil
}
return "", nil
}
func (cc *ClientConn) responseHeaderTimeout() time.Duration { func (cc *ClientConn) responseHeaderTimeout() time.Duration {
if cc.t.t1 != nil { if cc.t.t1 != nil {
return cc.t.t1.ResponseHeaderTimeout return cc.t.t1.ResponseHeaderTimeout
@ -1303,22 +1286,6 @@ func (cc *ClientConn) responseHeaderTimeout() time.Duration {
return 0 return 0
} }
// checkConnHeaders checks whether req has any invalid connection-level headers.
// per RFC 7540 section 8.1.2.2: Connection-Specific Header Fields.
// Certain headers are special-cased as okay but not transmitted later.
func checkConnHeaders(req *http.Request) error {
if v := req.Header.Get("Upgrade"); v != "" {
return fmt.Errorf("http2: invalid Upgrade request header: %q", req.Header["Upgrade"])
}
if vv := req.Header["Transfer-Encoding"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && vv[0] != "chunked") {
return fmt.Errorf("http2: invalid Transfer-Encoding request header: %q", vv)
}
if vv := req.Header["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !asciiEqualFold(vv[0], "close") && !asciiEqualFold(vv[0], "keep-alive")) {
return fmt.Errorf("http2: invalid Connection request header: %q", vv)
}
return nil
}
// actualContentLength returns a sanitized version of // actualContentLength returns a sanitized version of
// req.ContentLength, where 0 actually means zero (not unknown) and -1 // req.ContentLength, where 0 actually means zero (not unknown) and -1
// means unknown. // means unknown.
@ -1364,25 +1331,7 @@ func (cc *ClientConn) roundTrip(req *http.Request, streamf func(*clientStream))
donec: make(chan struct{}), donec: make(chan struct{}),
} }
// TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere? cs.requestedGzip = httpcommon.IsRequestGzip(req.Method, req.Header, cc.t.disableCompression())
if !cc.t.disableCompression() &&
req.Header.Get("Accept-Encoding") == "" &&
req.Header.Get("Range") == "" &&
!cs.isHead {
// Request gzip only, not deflate. Deflate is ambiguous and
// not as universally supported anyway.
// See: https://zlib.net/zlib_faq.html#faq39
//
// Note that we don't request this for HEAD requests,
// due to a bug in nginx:
// http://trac.nginx.org/nginx/ticket/358
// https://golang.org/issue/5522
//
// We don't request gzip if the request is for a range, since
// auto-decoding a portion of a gzipped document will just fail
// anyway. See https://golang.org/issue/8923
cs.requestedGzip = true
}
go cs.doRequest(req, streamf) go cs.doRequest(req, streamf)
@ -1496,10 +1445,6 @@ func (cs *clientStream) writeRequest(req *http.Request, streamf func(*clientStre
cc := cs.cc cc := cs.cc
ctx := cs.ctx ctx := cs.ctx
if err := checkConnHeaders(req); err != nil {
return err
}
// wait for setting frames to be received, a server can change this value later, // wait for setting frames to be received, a server can change this value later,
// but we just wait for the first settings frame // but we just wait for the first settings frame
var isExtendedConnect bool var isExtendedConnect bool
@ -1663,26 +1608,39 @@ func (cs *clientStream) encodeAndWriteHeaders(req *http.Request) error {
// we send: HEADERS{1}, CONTINUATION{0,} + DATA{0,} (DATA is // we send: HEADERS{1}, CONTINUATION{0,} + DATA{0,} (DATA is
// sent by writeRequestBody below, along with any Trailers, // sent by writeRequestBody below, along with any Trailers,
// again in form HEADERS{1}, CONTINUATION{0,}) // again in form HEADERS{1}, CONTINUATION{0,})
trailers, err := commaSeparatedTrailers(req) cc.hbuf.Reset()
res, err := encodeRequestHeaders(req, cs.requestedGzip, cc.peerMaxHeaderListSize, func(name, value string) {
cc.writeHeader(name, value)
})
if err != nil { if err != nil {
return err return fmt.Errorf("http2: %w", err)
}
hasTrailers := trailers != ""
contentLen := actualContentLength(req)
hasBody := contentLen != 0
hdrs, err := cc.encodeHeaders(req, cs.requestedGzip, trailers, contentLen)
if err != nil {
return err
} }
hdrs := cc.hbuf.Bytes()
// Write the request. // Write the request.
endStream := !hasBody && !hasTrailers endStream := !res.HasBody && !res.HasTrailers
cs.sentHeaders = true cs.sentHeaders = true
err = cc.writeHeaders(cs.ID, endStream, int(cc.maxFrameSize), hdrs) err = cc.writeHeaders(cs.ID, endStream, int(cc.maxFrameSize), hdrs)
traceWroteHeaders(cs.trace) traceWroteHeaders(cs.trace)
return err return err
} }
func encodeRequestHeaders(req *http.Request, addGzipHeader bool, peerMaxHeaderListSize uint64, headerf func(name, value string)) (httpcommon.EncodeHeadersResult, error) {
return httpcommon.EncodeHeaders(req.Context(), httpcommon.EncodeHeadersParam{
Request: httpcommon.Request{
Header: req.Header,
Trailer: req.Trailer,
URL: req.URL,
Host: req.Host,
Method: req.Method,
ActualContentLength: actualContentLength(req),
},
AddGzipHeader: addGzipHeader,
PeerMaxHeaderListSize: peerMaxHeaderListSize,
DefaultUserAgent: defaultUserAgent,
}, headerf)
}
// cleanupWriteRequest performs post-request tasks. // cleanupWriteRequest performs post-request tasks.
// //
// If err (the result of writeRequest) is non-nil and the stream is not closed, // If err (the result of writeRequest) is non-nil and the stream is not closed,
@ -2070,218 +2028,6 @@ func (cs *clientStream) awaitFlowControl(maxBytes int) (taken int32, err error)
} }
} }
func validateHeaders(hdrs http.Header) string {
for k, vv := range hdrs {
if !httpguts.ValidHeaderFieldName(k) && k != ":protocol" {
return fmt.Sprintf("name %q", k)
}
for _, v := range vv {
if !httpguts.ValidHeaderFieldValue(v) {
// Don't include the value in the error,
// because it may be sensitive.
return fmt.Sprintf("value for header %q", k)
}
}
}
return ""
}
var errNilRequestURL = errors.New("http2: Request.URI is nil")
func isNormalConnect(req *http.Request) bool {
return req.Method == "CONNECT" && req.Header.Get(":protocol") == ""
}
// requires cc.wmu be held.
func (cc *ClientConn) encodeHeaders(req *http.Request, addGzipHeader bool, trailers string, contentLength int64) ([]byte, error) {
cc.hbuf.Reset()
if req.URL == nil {
return nil, errNilRequestURL
}
host := req.Host
if host == "" {
host = req.URL.Host
}
host, err := httpguts.PunycodeHostPort(host)
if err != nil {
return nil, err
}
if !httpguts.ValidHostHeader(host) {
return nil, errors.New("http2: invalid Host header")
}
var path string
if !isNormalConnect(req) {
path = req.URL.RequestURI()
if !validPseudoPath(path) {
orig := path
path = strings.TrimPrefix(path, req.URL.Scheme+"://"+host)
if !validPseudoPath(path) {
if req.URL.Opaque != "" {
return nil, fmt.Errorf("invalid request :path %q from URL.Opaque = %q", orig, req.URL.Opaque)
} else {
return nil, fmt.Errorf("invalid request :path %q", orig)
}
}
}
}
// Check for any invalid headers+trailers and return an error before we
// potentially pollute our hpack state. (We want to be able to
// continue to reuse the hpack encoder for future requests)
if err := validateHeaders(req.Header); err != "" {
return nil, fmt.Errorf("invalid HTTP header %s", err)
}
if err := validateHeaders(req.Trailer); err != "" {
return nil, fmt.Errorf("invalid HTTP trailer %s", err)
}
enumerateHeaders := func(f func(name, value string)) {
// 8.1.2.3 Request Pseudo-Header Fields
// The :path pseudo-header field includes the path and query parts of the
// target URI (the path-absolute production and optionally a '?' character
// followed by the query production, see Sections 3.3 and 3.4 of
// [RFC3986]).
f(":authority", host)
m := req.Method
if m == "" {
m = http.MethodGet
}
f(":method", m)
if !isNormalConnect(req) {
f(":path", path)
f(":scheme", req.URL.Scheme)
}
if trailers != "" {
f("trailer", trailers)
}
var didUA bool
for k, vv := range req.Header {
if asciiEqualFold(k, "host") || asciiEqualFold(k, "content-length") {
// Host is :authority, already sent.
// Content-Length is automatic, set below.
continue
} else if asciiEqualFold(k, "connection") ||
asciiEqualFold(k, "proxy-connection") ||
asciiEqualFold(k, "transfer-encoding") ||
asciiEqualFold(k, "upgrade") ||
asciiEqualFold(k, "keep-alive") {
// Per 8.1.2.2 Connection-Specific Header
// Fields, don't send connection-specific
// fields. We have already checked if any
// are error-worthy so just ignore the rest.
continue
} else if asciiEqualFold(k, "user-agent") {
// Match Go's http1 behavior: at most one
// User-Agent. If set to nil or empty string,
// then omit it. Otherwise if not mentioned,
// include the default (below).
didUA = true
if len(vv) < 1 {
continue
}
vv = vv[:1]
if vv[0] == "" {
continue
}
} else if asciiEqualFold(k, "cookie") {
// Per 8.1.2.5 To allow for better compression efficiency, the
// Cookie header field MAY be split into separate header fields,
// each with one or more cookie-pairs.
for _, v := range vv {
for {
p := strings.IndexByte(v, ';')
if p < 0 {
break
}
f("cookie", v[:p])
p++
// strip space after semicolon if any.
for p+1 <= len(v) && v[p] == ' ' {
p++
}
v = v[p:]
}
if len(v) > 0 {
f("cookie", v)
}
}
continue
}
for _, v := range vv {
f(k, v)
}
}
if shouldSendReqContentLength(req.Method, contentLength) {
f("content-length", strconv.FormatInt(contentLength, 10))
}
if addGzipHeader {
f("accept-encoding", "gzip")
}
if !didUA {
f("user-agent", defaultUserAgent)
}
}
// Do a first pass over the headers counting bytes to ensure
// we don't exceed cc.peerMaxHeaderListSize. This is done as a
// separate pass before encoding the headers to prevent
// modifying the hpack state.
hlSize := uint64(0)
enumerateHeaders(func(name, value string) {
hf := hpack.HeaderField{Name: name, Value: value}
hlSize += uint64(hf.Size())
})
if hlSize > cc.peerMaxHeaderListSize {
return nil, errRequestHeaderListSize
}
trace := httptrace.ContextClientTrace(req.Context())
traceHeaders := traceHasWroteHeaderField(trace)
// Header list size is ok. Write the headers.
enumerateHeaders(func(name, value string) {
name, ascii := lowerHeader(name)
if !ascii {
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
// field names have to be ASCII characters (just as in HTTP/1.x).
return
}
cc.writeHeader(name, value)
if traceHeaders {
traceWroteHeaderField(trace, name, value)
}
})
return cc.hbuf.Bytes(), nil
}
// shouldSendReqContentLength reports whether the http2.Transport should send
// a "content-length" request header. This logic is basically a copy of the net/http
// transferWriter.shouldSendContentLength.
// The contentLength is the corrected contentLength (so 0 means actually 0, not unknown).
// -1 means unknown.
func shouldSendReqContentLength(method string, contentLength int64) bool {
if contentLength > 0 {
return true
}
if contentLength < 0 {
return false
}
// For zero bodies, whether we send a content-length depends on the method.
// It also kinda doesn't matter for http2 either way, with END_STREAM.
switch method {
case "POST", "PUT", "PATCH":
return true
default:
return false
}
}
// requires cc.wmu be held. // requires cc.wmu be held.
func (cc *ClientConn) encodeTrailers(trailer http.Header) ([]byte, error) { func (cc *ClientConn) encodeTrailers(trailer http.Header) ([]byte, error) {
cc.hbuf.Reset() cc.hbuf.Reset()
@ -2298,7 +2044,7 @@ func (cc *ClientConn) encodeTrailers(trailer http.Header) ([]byte, error) {
} }
for k, vv := range trailer { for k, vv := range trailer {
lowKey, ascii := lowerHeader(k) lowKey, ascii := httpcommon.LowerHeader(k)
if !ascii { if !ascii {
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
// field names have to be ASCII characters (just as in HTTP/1.x). // field names have to be ASCII characters (just as in HTTP/1.x).
@ -2464,6 +2210,13 @@ func (rl *clientConnReadLoop) cleanup() {
} }
cc.cond.Broadcast() cc.cond.Broadcast()
cc.mu.Unlock() cc.mu.Unlock()
if !cc.seenSettings {
// If we have a pending request that wants extended CONNECT,
// let it continue and fail with the connection error.
cc.extendedConnectAllowed = true
close(cc.seenSettingsChan)
}
} }
// countReadFrameError calls Transport.CountError with a string // countReadFrameError calls Transport.CountError with a string
@ -2556,9 +2309,6 @@ func (rl *clientConnReadLoop) run() error {
if VerboseLogs { if VerboseLogs {
cc.vlogf("http2: Transport conn %p received error from processing frame %v: %v", cc, summarizeFrame(f), err) cc.vlogf("http2: Transport conn %p received error from processing frame %v: %v", cc, summarizeFrame(f), err)
} }
if !cc.seenSettings {
close(cc.seenSettingsChan)
}
return err return err
} }
} }
@ -2653,7 +2403,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
Status: status + " " + http.StatusText(statusCode), Status: status + " " + http.StatusText(statusCode),
} }
for _, hf := range regularFields { for _, hf := range regularFields {
key := canonicalHeader(hf.Name) key := httpcommon.CanonicalHeader(hf.Name)
if key == "Trailer" { if key == "Trailer" {
t := res.Trailer t := res.Trailer
if t == nil { if t == nil {
@ -2661,7 +2411,7 @@ func (rl *clientConnReadLoop) handleResponse(cs *clientStream, f *MetaHeadersFra
res.Trailer = t res.Trailer = t
} }
foreachHeaderElement(hf.Value, func(v string) { foreachHeaderElement(hf.Value, func(v string) {
t[canonicalHeader(v)] = nil t[httpcommon.CanonicalHeader(v)] = nil
}) })
} else { } else {
vv := header[key] vv := header[key]
@ -2785,7 +2535,7 @@ func (rl *clientConnReadLoop) processTrailers(cs *clientStream, f *MetaHeadersFr
trailer := make(http.Header) trailer := make(http.Header)
for _, hf := range f.RegularFields() { for _, hf := range f.RegularFields() {
key := canonicalHeader(hf.Name) key := httpcommon.CanonicalHeader(hf.Name)
trailer[key] = append(trailer[key], hf.Value) trailer[key] = append(trailer[key], hf.Value)
} }
cs.trailer = trailer cs.trailer = trailer
@ -3331,7 +3081,7 @@ func (cc *ClientConn) writeStreamReset(streamID uint32, code ErrCode, ping bool,
var ( var (
errResponseHeaderListSize = errors.New("http2: response header list larger than advertised limit") errResponseHeaderListSize = errors.New("http2: response header list larger than advertised limit")
errRequestHeaderListSize = errors.New("http2: request header list larger than peer's advertised limit") errRequestHeaderListSize = httpcommon.ErrRequestHeaderListSize
) )
func (cc *ClientConn) logf(format string, args ...interface{}) { func (cc *ClientConn) logf(format string, args ...interface{}) {
@ -3515,16 +3265,6 @@ func traceFirstResponseByte(trace *httptrace.ClientTrace) {
} }
} }
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
return trace != nil && trace.WroteHeaderField != nil
}
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
if trace != nil && trace.WroteHeaderField != nil {
trace.WroteHeaderField(k, []string{v})
}
}
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error { func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
if trace != nil { if trace != nil {
return trace.Got1xxResponse return trace.Got1xxResponse

View File

@ -13,6 +13,7 @@ import (
"golang.org/x/net/http/httpguts" "golang.org/x/net/http/httpguts"
"golang.org/x/net/http2/hpack" "golang.org/x/net/http2/hpack"
"golang.org/x/net/internal/httpcommon"
) )
// writeFramer is implemented by any type that is used to write frames. // writeFramer is implemented by any type that is used to write frames.
@ -351,7 +352,7 @@ func encodeHeaders(enc *hpack.Encoder, h http.Header, keys []string) {
} }
for _, k := range keys { for _, k := range keys {
vv := h[k] vv := h[k]
k, ascii := lowerHeader(k) k, ascii := httpcommon.LowerHeader(k)
if !ascii { if !ascii {
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header // Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
// field names have to be ASCII characters (just as in HTTP/1.x). // field names have to be ASCII characters (just as in HTTP/1.x).

53
vendor/golang.org/x/net/internal/httpcommon/ascii.go generated vendored Normal file
View File

@ -0,0 +1,53 @@
// Copyright 2025 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 httpcommon
import "strings"
// The HTTP protocols are defined in terms of ASCII, not Unicode. This file
// contains helper functions which may use Unicode-aware functions which would
// otherwise be unsafe and could introduce vulnerabilities if used improperly.
// asciiEqualFold is strings.EqualFold, ASCII only. It reports whether s and t
// are equal, ASCII-case-insensitively.
func asciiEqualFold(s, t string) bool {
if len(s) != len(t) {
return false
}
for i := 0; i < len(s); i++ {
if lower(s[i]) != lower(t[i]) {
return false
}
}
return true
}
// lower returns the ASCII lowercase version of b.
func lower(b byte) byte {
if 'A' <= b && b <= 'Z' {
return b + ('a' - 'A')
}
return b
}
// isASCIIPrint returns whether s is ASCII and printable according to
// https://tools.ietf.org/html/rfc20#section-4.2.
func isASCIIPrint(s string) bool {
for i := 0; i < len(s); i++ {
if s[i] < ' ' || s[i] > '~' {
return false
}
}
return true
}
// asciiToLower returns the lowercase version of s if s is ASCII and printable,
// and whether or not it was.
func asciiToLower(s string) (lower string, ok bool) {
if !isASCIIPrint(s) {
return "", false
}
return strings.ToLower(s), true
}

View File

@ -1,11 +1,11 @@
// Copyright 2014 The Go Authors. All rights reserved. // Copyright 2025 The Go Authors. All rights reserved.
// 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.
package http2 package httpcommon
import ( import (
"net/http" "net/textproto"
"sync" "sync"
) )
@ -82,13 +82,15 @@ func buildCommonHeaderMaps() {
commonLowerHeader = make(map[string]string, len(common)) commonLowerHeader = make(map[string]string, len(common))
commonCanonHeader = make(map[string]string, len(common)) commonCanonHeader = make(map[string]string, len(common))
for _, v := range common { for _, v := range common {
chk := http.CanonicalHeaderKey(v) chk := textproto.CanonicalMIMEHeaderKey(v)
commonLowerHeader[chk] = v commonLowerHeader[chk] = v
commonCanonHeader[v] = chk commonCanonHeader[v] = chk
} }
} }
func lowerHeader(v string) (lower string, ascii bool) { // LowerHeader returns the lowercase form of a header name,
// used on the wire for HTTP/2 and HTTP/3 requests.
func LowerHeader(v string) (lower string, ascii bool) {
buildCommonHeaderMapsOnce() buildCommonHeaderMapsOnce()
if s, ok := commonLowerHeader[v]; ok { if s, ok := commonLowerHeader[v]; ok {
return s, true return s, true
@ -96,10 +98,18 @@ func lowerHeader(v string) (lower string, ascii bool) {
return asciiToLower(v) return asciiToLower(v)
} }
func canonicalHeader(v string) string { // CanonicalHeader canonicalizes a header name. (For example, "host" becomes "Host".)
func CanonicalHeader(v string) string {
buildCommonHeaderMapsOnce() buildCommonHeaderMapsOnce()
if s, ok := commonCanonHeader[v]; ok { if s, ok := commonCanonHeader[v]; ok {
return s return s
} }
return http.CanonicalHeaderKey(v) return textproto.CanonicalMIMEHeaderKey(v)
}
// CachedCanonicalHeader returns the canonical form of a well-known header name.
func CachedCanonicalHeader(v string) (string, bool) {
buildCommonHeaderMapsOnce()
s, ok := commonCanonHeader[v]
return s, ok
} }

467
vendor/golang.org/x/net/internal/httpcommon/request.go generated vendored Normal file
View File

@ -0,0 +1,467 @@
// Copyright 2025 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 httpcommon
import (
"context"
"errors"
"fmt"
"net/http/httptrace"
"net/textproto"
"net/url"
"sort"
"strconv"
"strings"
"golang.org/x/net/http/httpguts"
"golang.org/x/net/http2/hpack"
)
var (
ErrRequestHeaderListSize = errors.New("request header list larger than peer's advertised limit")
)
// Request is a subset of http.Request.
// It'd be simpler to pass an *http.Request, of course, but we can't depend on net/http
// without creating a dependency cycle.
type Request struct {
URL *url.URL
Method string
Host string
Header map[string][]string
Trailer map[string][]string
ActualContentLength int64 // 0 means 0, -1 means unknown
}
// EncodeHeadersParam is parameters to EncodeHeaders.
type EncodeHeadersParam struct {
Request Request
// AddGzipHeader indicates that an "accept-encoding: gzip" header should be
// added to the request.
AddGzipHeader bool
// PeerMaxHeaderListSize, when non-zero, is the peer's MAX_HEADER_LIST_SIZE setting.
PeerMaxHeaderListSize uint64
// DefaultUserAgent is the User-Agent header to send when the request
// neither contains a User-Agent nor disables it.
DefaultUserAgent string
}
// EncodeHeadersParam is the result of EncodeHeaders.
type EncodeHeadersResult struct {
HasBody bool
HasTrailers bool
}
// EncodeHeaders constructs request headers common to HTTP/2 and HTTP/3.
// It validates a request and calls headerf with each pseudo-header and header
// for the request.
// The headerf function is called with the validated, canonicalized header name.
func EncodeHeaders(ctx context.Context, param EncodeHeadersParam, headerf func(name, value string)) (res EncodeHeadersResult, _ error) {
req := param.Request
// Check for invalid connection-level headers.
if err := checkConnHeaders(req.Header); err != nil {
return res, err
}
if req.URL == nil {
return res, errors.New("Request.URL is nil")
}
host := req.Host
if host == "" {
host = req.URL.Host
}
host, err := httpguts.PunycodeHostPort(host)
if err != nil {
return res, err
}
if !httpguts.ValidHostHeader(host) {
return res, errors.New("invalid Host header")
}
// isNormalConnect is true if this is a non-extended CONNECT request.
isNormalConnect := false
var protocol string
if vv := req.Header[":protocol"]; len(vv) > 0 {
protocol = vv[0]
}
if req.Method == "CONNECT" && protocol == "" {
isNormalConnect = true
} else if protocol != "" && req.Method != "CONNECT" {
return res, errors.New("invalid :protocol header in non-CONNECT request")
}
// Validate the path, except for non-extended CONNECT requests which have no path.
var path string
if !isNormalConnect {
path = req.URL.RequestURI()
if !validPseudoPath(path) {
orig := path
path = strings.TrimPrefix(path, req.URL.Scheme+"://"+host)
if !validPseudoPath(path) {
if req.URL.Opaque != "" {
return res, fmt.Errorf("invalid request :path %q from URL.Opaque = %q", orig, req.URL.Opaque)
} else {
return res, fmt.Errorf("invalid request :path %q", orig)
}
}
}
}
// Check for any invalid headers+trailers and return an error before we
// potentially pollute our hpack state. (We want to be able to
// continue to reuse the hpack encoder for future requests)
if err := validateHeaders(req.Header); err != "" {
return res, fmt.Errorf("invalid HTTP header %s", err)
}
if err := validateHeaders(req.Trailer); err != "" {
return res, fmt.Errorf("invalid HTTP trailer %s", err)
}
trailers, err := commaSeparatedTrailers(req.Trailer)
if err != nil {
return res, err
}
enumerateHeaders := func(f func(name, value string)) {
// 8.1.2.3 Request Pseudo-Header Fields
// The :path pseudo-header field includes the path and query parts of the
// target URI (the path-absolute production and optionally a '?' character
// followed by the query production, see Sections 3.3 and 3.4 of
// [RFC3986]).
f(":authority", host)
m := req.Method
if m == "" {
m = "GET"
}
f(":method", m)
if !isNormalConnect {
f(":path", path)
f(":scheme", req.URL.Scheme)
}
if protocol != "" {
f(":protocol", protocol)
}
if trailers != "" {
f("trailer", trailers)
}
var didUA bool
for k, vv := range req.Header {
if asciiEqualFold(k, "host") || asciiEqualFold(k, "content-length") {
// Host is :authority, already sent.
// Content-Length is automatic, set below.
continue
} else if asciiEqualFold(k, "connection") ||
asciiEqualFold(k, "proxy-connection") ||
asciiEqualFold(k, "transfer-encoding") ||
asciiEqualFold(k, "upgrade") ||
asciiEqualFold(k, "keep-alive") {
// Per 8.1.2.2 Connection-Specific Header
// Fields, don't send connection-specific
// fields. We have already checked if any
// are error-worthy so just ignore the rest.
continue
} else if asciiEqualFold(k, "user-agent") {
// Match Go's http1 behavior: at most one
// User-Agent. If set to nil or empty string,
// then omit it. Otherwise if not mentioned,
// include the default (below).
didUA = true
if len(vv) < 1 {
continue
}
vv = vv[:1]
if vv[0] == "" {
continue
}
} else if asciiEqualFold(k, "cookie") {
// Per 8.1.2.5 To allow for better compression efficiency, the
// Cookie header field MAY be split into separate header fields,
// each with one or more cookie-pairs.
for _, v := range vv {
for {
p := strings.IndexByte(v, ';')
if p < 0 {
break
}
f("cookie", v[:p])
p++
// strip space after semicolon if any.
for p+1 <= len(v) && v[p] == ' ' {
p++
}
v = v[p:]
}
if len(v) > 0 {
f("cookie", v)
}
}
continue
} else if k == ":protocol" {
// :protocol pseudo-header was already sent above.
continue
}
for _, v := range vv {
f(k, v)
}
}
if shouldSendReqContentLength(req.Method, req.ActualContentLength) {
f("content-length", strconv.FormatInt(req.ActualContentLength, 10))
}
if param.AddGzipHeader {
f("accept-encoding", "gzip")
}
if !didUA {
f("user-agent", param.DefaultUserAgent)
}
}
// Do a first pass over the headers counting bytes to ensure
// we don't exceed cc.peerMaxHeaderListSize. This is done as a
// separate pass before encoding the headers to prevent
// modifying the hpack state.
if param.PeerMaxHeaderListSize > 0 {
hlSize := uint64(0)
enumerateHeaders(func(name, value string) {
hf := hpack.HeaderField{Name: name, Value: value}
hlSize += uint64(hf.Size())
})
if hlSize > param.PeerMaxHeaderListSize {
return res, ErrRequestHeaderListSize
}
}
trace := httptrace.ContextClientTrace(ctx)
// Header list size is ok. Write the headers.
enumerateHeaders(func(name, value string) {
name, ascii := LowerHeader(name)
if !ascii {
// Skip writing invalid headers. Per RFC 7540, Section 8.1.2, header
// field names have to be ASCII characters (just as in HTTP/1.x).
return
}
headerf(name, value)
if trace != nil && trace.WroteHeaderField != nil {
trace.WroteHeaderField(name, []string{value})
}
})
res.HasBody = req.ActualContentLength != 0
res.HasTrailers = trailers != ""
return res, nil
}
// IsRequestGzip reports whether we should add an Accept-Encoding: gzip header
// for a request.
func IsRequestGzip(method string, header map[string][]string, disableCompression bool) bool {
// TODO(bradfitz): this is a copy of the logic in net/http. Unify somewhere?
if !disableCompression &&
len(header["Accept-Encoding"]) == 0 &&
len(header["Range"]) == 0 &&
method != "HEAD" {
// Request gzip only, not deflate. Deflate is ambiguous and
// not as universally supported anyway.
// See: https://zlib.net/zlib_faq.html#faq39
//
// Note that we don't request this for HEAD requests,
// due to a bug in nginx:
// http://trac.nginx.org/nginx/ticket/358
// https://golang.org/issue/5522
//
// We don't request gzip if the request is for a range, since
// auto-decoding a portion of a gzipped document will just fail
// anyway. See https://golang.org/issue/8923
return true
}
return false
}
// checkConnHeaders checks whether req has any invalid connection-level headers.
//
// https://www.rfc-editor.org/rfc/rfc9114.html#section-4.2-3
// https://www.rfc-editor.org/rfc/rfc9113.html#section-8.2.2-1
//
// Certain headers are special-cased as okay but not transmitted later.
// For example, we allow "Transfer-Encoding: chunked", but drop the header when encoding.
func checkConnHeaders(h map[string][]string) error {
if vv := h["Upgrade"]; len(vv) > 0 && (vv[0] != "" && vv[0] != "chunked") {
return fmt.Errorf("invalid Upgrade request header: %q", vv)
}
if vv := h["Transfer-Encoding"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && vv[0] != "chunked") {
return fmt.Errorf("invalid Transfer-Encoding request header: %q", vv)
}
if vv := h["Connection"]; len(vv) > 0 && (len(vv) > 1 || vv[0] != "" && !asciiEqualFold(vv[0], "close") && !asciiEqualFold(vv[0], "keep-alive")) {
return fmt.Errorf("invalid Connection request header: %q", vv)
}
return nil
}
func commaSeparatedTrailers(trailer map[string][]string) (string, error) {
keys := make([]string, 0, len(trailer))
for k := range trailer {
k = CanonicalHeader(k)
switch k {
case "Transfer-Encoding", "Trailer", "Content-Length":
return "", fmt.Errorf("invalid Trailer key %q", k)
}
keys = append(keys, k)
}
if len(keys) > 0 {
sort.Strings(keys)
return strings.Join(keys, ","), nil
}
return "", nil
}
// validPseudoPath reports whether v is a valid :path pseudo-header
// value. It must be either:
//
// - a non-empty string starting with '/'
// - the string '*', for OPTIONS requests.
//
// For now this is only used a quick check for deciding when to clean
// up Opaque URLs before sending requests from the Transport.
// See golang.org/issue/16847
//
// We used to enforce that the path also didn't start with "//", but
// Google's GFE accepts such paths and Chrome sends them, so ignore
// that part of the spec. See golang.org/issue/19103.
func validPseudoPath(v string) bool {
return (len(v) > 0 && v[0] == '/') || v == "*"
}
func validateHeaders(hdrs map[string][]string) string {
for k, vv := range hdrs {
if !httpguts.ValidHeaderFieldName(k) && k != ":protocol" {
return fmt.Sprintf("name %q", k)
}
for _, v := range vv {
if !httpguts.ValidHeaderFieldValue(v) {
// Don't include the value in the error,
// because it may be sensitive.
return fmt.Sprintf("value for header %q", k)
}
}
}
return ""
}
// shouldSendReqContentLength reports whether we should send
// a "content-length" request header. This logic is basically a copy of the net/http
// transferWriter.shouldSendContentLength.
// The contentLength is the corrected contentLength (so 0 means actually 0, not unknown).
// -1 means unknown.
func shouldSendReqContentLength(method string, contentLength int64) bool {
if contentLength > 0 {
return true
}
if contentLength < 0 {
return false
}
// For zero bodies, whether we send a content-length depends on the method.
// It also kinda doesn't matter for http2 either way, with END_STREAM.
switch method {
case "POST", "PUT", "PATCH":
return true
default:
return false
}
}
// ServerRequestParam is parameters to NewServerRequest.
type ServerRequestParam struct {
Method string
Scheme, Authority, Path string
Protocol string
Header map[string][]string
}
// ServerRequestResult is the result of NewServerRequest.
type ServerRequestResult struct {
// Various http.Request fields.
URL *url.URL
RequestURI string
Trailer map[string][]string
NeedsContinue bool // client provided an "Expect: 100-continue" header
// If the request should be rejected, this is a short string suitable for passing
// to the http2 package's CountError function.
// It might be a bit odd to return errors this way rather than returing an error,
// but this ensures we don't forget to include a CountError reason.
InvalidReason string
}
func NewServerRequest(rp ServerRequestParam) ServerRequestResult {
needsContinue := httpguts.HeaderValuesContainsToken(rp.Header["Expect"], "100-continue")
if needsContinue {
delete(rp.Header, "Expect")
}
// Merge Cookie headers into one "; "-delimited value.
if cookies := rp.Header["Cookie"]; len(cookies) > 1 {
rp.Header["Cookie"] = []string{strings.Join(cookies, "; ")}
}
// Setup Trailers
var trailer map[string][]string
for _, v := range rp.Header["Trailer"] {
for _, key := range strings.Split(v, ",") {
key = textproto.CanonicalMIMEHeaderKey(textproto.TrimString(key))
switch key {
case "Transfer-Encoding", "Trailer", "Content-Length":
// Bogus. (copy of http1 rules)
// Ignore.
default:
if trailer == nil {
trailer = make(map[string][]string)
}
trailer[key] = nil
}
}
}
delete(rp.Header, "Trailer")
// "':authority' MUST NOT include the deprecated userinfo subcomponent
// for "http" or "https" schemed URIs."
// https://www.rfc-editor.org/rfc/rfc9113.html#section-8.3.1-2.3.8
if strings.IndexByte(rp.Authority, '@') != -1 && (rp.Scheme == "http" || rp.Scheme == "https") {
return ServerRequestResult{
InvalidReason: "userinfo_in_authority",
}
}
var url_ *url.URL
var requestURI string
if rp.Method == "CONNECT" && rp.Protocol == "" {
url_ = &url.URL{Host: rp.Authority}
requestURI = rp.Authority // mimic HTTP/1 server behavior
} else {
var err error
url_, err = url.ParseRequestURI(rp.Path)
if err != nil {
return ServerRequestResult{
InvalidReason: "bad_path",
}
}
requestURI = rp.Path
}
return ServerRequestResult{
URL: url_,
NeedsContinue: needsContinue,
RequestURI: requestURI,
Trailer: trailer,
}
}

View File

@ -7,6 +7,7 @@ package proxy
import ( import (
"context" "context"
"net" "net"
"net/netip"
"strings" "strings"
) )
@ -57,7 +58,8 @@ func (p *PerHost) DialContext(ctx context.Context, network, addr string) (c net.
} }
func (p *PerHost) dialerForRequest(host string) Dialer { func (p *PerHost) dialerForRequest(host string) Dialer {
if ip := net.ParseIP(host); ip != nil { if nip, err := netip.ParseAddr(host); err == nil {
ip := net.IP(nip.AsSlice())
for _, net := range p.bypassNetworks { for _, net := range p.bypassNetworks {
if net.Contains(ip) { if net.Contains(ip) {
return p.bypass return p.bypass
@ -108,8 +110,8 @@ func (p *PerHost) AddFromString(s string) {
} }
continue continue
} }
if ip := net.ParseIP(host); ip != nil { if nip, err := netip.ParseAddr(host); err == nil {
p.AddIP(ip) p.AddIP(net.IP(nip.AsSlice()))
continue continue
} }
if strings.HasPrefix(host, "*.") { if strings.HasPrefix(host, "*.") {

View File

@ -6,9 +6,10 @@
// as specified in RFC 6455. // as specified in RFC 6455.
// //
// This package currently lacks some features found in an alternative // This package currently lacks some features found in an alternative
// and more actively maintained WebSocket package: // and more actively maintained WebSocket packages:
// //
// https://pkg.go.dev/github.com/coder/websocket // - [github.com/gorilla/websocket]
// - [github.com/coder/websocket]
package websocket // import "golang.org/x/net/websocket" package websocket // import "golang.org/x/net/websocket"
import ( import (

View File

@ -46,7 +46,7 @@ func (g *Group) done() {
// returns a non-nil error or the first time Wait returns, whichever occurs // returns a non-nil error or the first time Wait returns, whichever occurs
// first. // first.
func WithContext(ctx context.Context) (*Group, context.Context) { func WithContext(ctx context.Context) (*Group, context.Context) {
ctx, cancel := withCancelCause(ctx) ctx, cancel := context.WithCancelCause(ctx)
return &Group{cancel: cancel}, ctx return &Group{cancel: cancel}, ctx
} }
@ -118,6 +118,7 @@ func (g *Group) TryGo(f func() error) bool {
// SetLimit limits the number of active goroutines in this group to at most n. // SetLimit limits the number of active goroutines in this group to at most n.
// A negative value indicates no limit. // A negative value indicates no limit.
// A limit of zero will prevent any new goroutines from being added.
// //
// Any subsequent call to the Go method will block until it can add an active // Any subsequent call to the Go method will block until it can add an active
// goroutine without exceeding the configured limit. // goroutine without exceeding the configured limit.

View File

@ -1,13 +0,0 @@
// Copyright 2023 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 go1.20
package errgroup
import "context"
func withCancelCause(parent context.Context) (context.Context, func(error)) {
return context.WithCancelCause(parent)
}

View File

@ -1,14 +0,0 @@
// Copyright 2023 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 !go1.20
package errgroup
import "context"
func withCancelCause(parent context.Context) (context.Context, func(error)) {
ctx, cancel := context.WithCancel(parent)
return ctx, func(error) { cancel() }
}

3
vendor/golang.org/x/sys/cpu/cpu.go generated vendored
View File

@ -72,6 +72,9 @@ var X86 struct {
HasSSSE3 bool // Supplemental streaming SIMD extension 3 HasSSSE3 bool // Supplemental streaming SIMD extension 3
HasSSE41 bool // Streaming SIMD extension 4 and 4.1 HasSSE41 bool // Streaming SIMD extension 4 and 4.1
HasSSE42 bool // Streaming SIMD extension 4 and 4.2 HasSSE42 bool // Streaming SIMD extension 4 and 4.2
HasAVXIFMA bool // Advanced vector extension Integer Fused Multiply Add
HasAVXVNNI bool // Advanced vector extension Vector Neural Network Instructions
HasAVXVNNIInt8 bool // Advanced vector extension Vector Neural Network Int8 instructions
_ CacheLinePad _ CacheLinePad
} }

View File

@ -53,6 +53,9 @@ func initOptions() {
{Name: "sse41", Feature: &X86.HasSSE41}, {Name: "sse41", Feature: &X86.HasSSE41},
{Name: "sse42", Feature: &X86.HasSSE42}, {Name: "sse42", Feature: &X86.HasSSE42},
{Name: "ssse3", Feature: &X86.HasSSSE3}, {Name: "ssse3", Feature: &X86.HasSSSE3},
{Name: "avxifma", Feature: &X86.HasAVXIFMA},
{Name: "avxvnni", Feature: &X86.HasAVXVNNI},
{Name: "avxvnniint8", Feature: &X86.HasAVXVNNIInt8},
// These capabilities should always be enabled on amd64: // These capabilities should always be enabled on amd64:
{Name: "sse2", Feature: &X86.HasSSE2, Required: runtime.GOARCH == "amd64"}, {Name: "sse2", Feature: &X86.HasSSE2, Required: runtime.GOARCH == "amd64"},
@ -106,7 +109,7 @@ func archInit() {
return return
} }
_, ebx7, ecx7, edx7 := cpuid(7, 0) eax7, ebx7, ecx7, edx7 := cpuid(7, 0)
X86.HasBMI1 = isSet(3, ebx7) X86.HasBMI1 = isSet(3, ebx7)
X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX
X86.HasBMI2 = isSet(8, ebx7) X86.HasBMI2 = isSet(8, ebx7)
@ -134,14 +137,24 @@ func archInit() {
X86.HasAVX512VAES = isSet(9, ecx7) X86.HasAVX512VAES = isSet(9, ecx7)
X86.HasAVX512VBMI2 = isSet(6, ecx7) X86.HasAVX512VBMI2 = isSet(6, ecx7)
X86.HasAVX512BITALG = isSet(12, ecx7) X86.HasAVX512BITALG = isSet(12, ecx7)
eax71, _, _, _ := cpuid(7, 1)
X86.HasAVX512BF16 = isSet(5, eax71)
} }
X86.HasAMXTile = isSet(24, edx7) X86.HasAMXTile = isSet(24, edx7)
X86.HasAMXInt8 = isSet(25, edx7) X86.HasAMXInt8 = isSet(25, edx7)
X86.HasAMXBF16 = isSet(22, edx7) X86.HasAMXBF16 = isSet(22, edx7)
// These features depend on the second level of extended features.
if eax7 >= 1 {
eax71, _, _, edx71 := cpuid(7, 1)
if X86.HasAVX512 {
X86.HasAVX512BF16 = isSet(5, eax71)
}
if X86.HasAVX {
X86.HasAVXIFMA = isSet(23, eax71)
X86.HasAVXVNNI = isSet(4, eax71)
X86.HasAVXVNNIInt8 = isSet(4, edx71)
}
}
} }
func isSet(bitpos uint, value uint32) bool { func isSet(bitpos uint, value uint32) bool {

36
vendor/golang.org/x/sys/unix/auxv.go generated vendored Normal file
View File

@ -0,0 +1,36 @@
// Copyright 2025 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 go1.21 && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos)
package unix
import (
"syscall"
"unsafe"
)
//go:linkname runtime_getAuxv runtime.getAuxv
func runtime_getAuxv() []uintptr
// Auxv returns the ELF auxiliary vector as a sequence of key/value pairs.
// The returned slice is always a fresh copy, owned by the caller.
// It returns an error on non-ELF platforms, or if the auxiliary vector cannot be accessed,
// which happens in some locked-down environments and build modes.
func Auxv() ([][2]uintptr, error) {
vec := runtime_getAuxv()
vecLen := len(vec)
if vecLen == 0 {
return nil, syscall.ENOENT
}
if vecLen%2 != 0 {
return nil, syscall.EINVAL
}
result := make([]uintptr, vecLen)
copy(result, vec)
return unsafe.Slice((*[2]uintptr)(unsafe.Pointer(&result[0])), vecLen/2), nil
}

13
vendor/golang.org/x/sys/unix/auxv_unsupported.go generated vendored Normal file
View File

@ -0,0 +1,13 @@
// Copyright 2025 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 !go1.21 && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos)
package unix
import "syscall"
func Auxv() ([][2]uintptr, error) {
return nil, syscall.ENOTSUP
}

View File

@ -1102,3 +1102,90 @@ func (s *Strioctl) SetInt(i int) {
func IoctlSetStrioctlRetInt(fd int, req int, s *Strioctl) (int, error) { func IoctlSetStrioctlRetInt(fd int, req int, s *Strioctl) (int, error) {
return ioctlPtrRet(fd, req, unsafe.Pointer(s)) return ioctlPtrRet(fd, req, unsafe.Pointer(s))
} }
// Ucred Helpers
// See ucred(3c) and getpeerucred(3c)
//sys getpeerucred(fd uintptr, ucred *uintptr) (err error)
//sys ucredFree(ucred uintptr) = ucred_free
//sys ucredGet(pid int) (ucred uintptr, err error) = ucred_get
//sys ucredGeteuid(ucred uintptr) (uid int) = ucred_geteuid
//sys ucredGetegid(ucred uintptr) (gid int) = ucred_getegid
//sys ucredGetruid(ucred uintptr) (uid int) = ucred_getruid
//sys ucredGetrgid(ucred uintptr) (gid int) = ucred_getrgid
//sys ucredGetsuid(ucred uintptr) (uid int) = ucred_getsuid
//sys ucredGetsgid(ucred uintptr) (gid int) = ucred_getsgid
//sys ucredGetpid(ucred uintptr) (pid int) = ucred_getpid
// Ucred is an opaque struct that holds user credentials.
type Ucred struct {
ucred uintptr
}
// We need to ensure that ucredFree is called on the underlying ucred
// when the Ucred is garbage collected.
func ucredFinalizer(u *Ucred) {
ucredFree(u.ucred)
}
func GetPeerUcred(fd uintptr) (*Ucred, error) {
var ucred uintptr
err := getpeerucred(fd, &ucred)
if err != nil {
return nil, err
}
result := &Ucred{
ucred: ucred,
}
// set the finalizer on the result so that the ucred will be freed
runtime.SetFinalizer(result, ucredFinalizer)
return result, nil
}
func UcredGet(pid int) (*Ucred, error) {
ucred, err := ucredGet(pid)
if err != nil {
return nil, err
}
result := &Ucred{
ucred: ucred,
}
// set the finalizer on the result so that the ucred will be freed
runtime.SetFinalizer(result, ucredFinalizer)
return result, nil
}
func (u *Ucred) Geteuid() int {
defer runtime.KeepAlive(u)
return ucredGeteuid(u.ucred)
}
func (u *Ucred) Getruid() int {
defer runtime.KeepAlive(u)
return ucredGetruid(u.ucred)
}
func (u *Ucred) Getsuid() int {
defer runtime.KeepAlive(u)
return ucredGetsuid(u.ucred)
}
func (u *Ucred) Getegid() int {
defer runtime.KeepAlive(u)
return ucredGetegid(u.ucred)
}
func (u *Ucred) Getrgid() int {
defer runtime.KeepAlive(u)
return ucredGetrgid(u.ucred)
}
func (u *Ucred) Getsgid() int {
defer runtime.KeepAlive(u)
return ucredGetsgid(u.ucred)
}
func (u *Ucred) Getpid() int {
defer runtime.KeepAlive(u)
return ucredGetpid(u.ucred)
}

View File

@ -1245,6 +1245,7 @@ const (
FAN_REPORT_DFID_NAME = 0xc00 FAN_REPORT_DFID_NAME = 0xc00
FAN_REPORT_DFID_NAME_TARGET = 0x1e00 FAN_REPORT_DFID_NAME_TARGET = 0x1e00
FAN_REPORT_DIR_FID = 0x400 FAN_REPORT_DIR_FID = 0x400
FAN_REPORT_FD_ERROR = 0x2000
FAN_REPORT_FID = 0x200 FAN_REPORT_FID = 0x200
FAN_REPORT_NAME = 0x800 FAN_REPORT_NAME = 0x800
FAN_REPORT_PIDFD = 0x80 FAN_REPORT_PIDFD = 0x80
@ -1330,8 +1331,10 @@ const (
FUSE_SUPER_MAGIC = 0x65735546 FUSE_SUPER_MAGIC = 0x65735546
FUTEXFS_SUPER_MAGIC = 0xbad1dea FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409 F_ADD_SEALS = 0x409
F_CREATED_QUERY = 0x404
F_DUPFD = 0x0 F_DUPFD = 0x0
F_DUPFD_CLOEXEC = 0x406 F_DUPFD_CLOEXEC = 0x406
F_DUPFD_QUERY = 0x403
F_EXLCK = 0x4 F_EXLCK = 0x4
F_GETFD = 0x1 F_GETFD = 0x1
F_GETFL = 0x3 F_GETFL = 0x3
@ -1551,6 +1554,7 @@ const (
IPPROTO_ROUTING = 0x2b IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e IPPROTO_RSVP = 0x2e
IPPROTO_SCTP = 0x84 IPPROTO_SCTP = 0x84
IPPROTO_SMC = 0x100
IPPROTO_TCP = 0x6 IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11 IPPROTO_UDP = 0x11
@ -1623,6 +1627,8 @@ const (
IPV6_UNICAST_IF = 0x4c IPV6_UNICAST_IF = 0x4c
IPV6_USER_FLOW = 0xe IPV6_USER_FLOW = 0xe
IPV6_V6ONLY = 0x1a IPV6_V6ONLY = 0x1a
IPV6_VERSION = 0x60
IPV6_VERSION_MASK = 0xf0
IPV6_XFRM_POLICY = 0x23 IPV6_XFRM_POLICY = 0x23
IP_ADD_MEMBERSHIP = 0x23 IP_ADD_MEMBERSHIP = 0x23
IP_ADD_SOURCE_MEMBERSHIP = 0x27 IP_ADD_SOURCE_MEMBERSHIP = 0x27
@ -1867,6 +1873,7 @@ const (
MADV_UNMERGEABLE = 0xd MADV_UNMERGEABLE = 0xd
MADV_WILLNEED = 0x3 MADV_WILLNEED = 0x3
MADV_WIPEONFORK = 0x12 MADV_WIPEONFORK = 0x12
MAP_DROPPABLE = 0x8
MAP_FILE = 0x0 MAP_FILE = 0x0
MAP_FIXED = 0x10 MAP_FIXED = 0x10
MAP_FIXED_NOREPLACE = 0x100000 MAP_FIXED_NOREPLACE = 0x100000
@ -1967,6 +1974,7 @@ const (
MSG_PEEK = 0x2 MSG_PEEK = 0x2
MSG_PROXY = 0x10 MSG_PROXY = 0x10
MSG_RST = 0x1000 MSG_RST = 0x1000
MSG_SOCK_DEVMEM = 0x2000000
MSG_SYN = 0x400 MSG_SYN = 0x400
MSG_TRUNC = 0x20 MSG_TRUNC = 0x20
MSG_TRYHARD = 0x4 MSG_TRYHARD = 0x4
@ -2083,6 +2091,7 @@ const (
NFC_ATR_REQ_MAXSIZE = 0x40 NFC_ATR_REQ_MAXSIZE = 0x40
NFC_ATR_RES_GB_MAXSIZE = 0x2f NFC_ATR_RES_GB_MAXSIZE = 0x2f
NFC_ATR_RES_MAXSIZE = 0x40 NFC_ATR_RES_MAXSIZE = 0x40
NFC_ATS_MAXSIZE = 0x14
NFC_COMM_ACTIVE = 0x0 NFC_COMM_ACTIVE = 0x0
NFC_COMM_PASSIVE = 0x1 NFC_COMM_PASSIVE = 0x1
NFC_DEVICE_NAME_MAXSIZE = 0x8 NFC_DEVICE_NAME_MAXSIZE = 0x8
@ -2163,6 +2172,7 @@ const (
NFNL_SUBSYS_QUEUE = 0x3 NFNL_SUBSYS_QUEUE = 0x3
NFNL_SUBSYS_ULOG = 0x4 NFNL_SUBSYS_ULOG = 0x4
NFS_SUPER_MAGIC = 0x6969 NFS_SUPER_MAGIC = 0x6969
NFT_BITWISE_BOOL = 0x0
NFT_CHAIN_FLAGS = 0x7 NFT_CHAIN_FLAGS = 0x7
NFT_CHAIN_MAXNAMELEN = 0x100 NFT_CHAIN_MAXNAMELEN = 0x100
NFT_CT_MAX = 0x17 NFT_CT_MAX = 0x17
@ -2491,6 +2501,7 @@ const (
PR_GET_PDEATHSIG = 0x2 PR_GET_PDEATHSIG = 0x2
PR_GET_SECCOMP = 0x15 PR_GET_SECCOMP = 0x15
PR_GET_SECUREBITS = 0x1b PR_GET_SECUREBITS = 0x1b
PR_GET_SHADOW_STACK_STATUS = 0x4a
PR_GET_SPECULATION_CTRL = 0x34 PR_GET_SPECULATION_CTRL = 0x34
PR_GET_TAGGED_ADDR_CTRL = 0x38 PR_GET_TAGGED_ADDR_CTRL = 0x38
PR_GET_THP_DISABLE = 0x2a PR_GET_THP_DISABLE = 0x2a
@ -2499,6 +2510,7 @@ const (
PR_GET_TIMING = 0xd PR_GET_TIMING = 0xd
PR_GET_TSC = 0x19 PR_GET_TSC = 0x19
PR_GET_UNALIGN = 0x5 PR_GET_UNALIGN = 0x5
PR_LOCK_SHADOW_STACK_STATUS = 0x4c
PR_MCE_KILL = 0x21 PR_MCE_KILL = 0x21
PR_MCE_KILL_CLEAR = 0x0 PR_MCE_KILL_CLEAR = 0x0
PR_MCE_KILL_DEFAULT = 0x2 PR_MCE_KILL_DEFAULT = 0x2
@ -2525,6 +2537,8 @@ const (
PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_GET_ENABLED_KEYS = 0x3d
PR_PAC_RESET_KEYS = 0x36 PR_PAC_RESET_KEYS = 0x36
PR_PAC_SET_ENABLED_KEYS = 0x3c PR_PAC_SET_ENABLED_KEYS = 0x3c
PR_PMLEN_MASK = 0x7f000000
PR_PMLEN_SHIFT = 0x18
PR_PPC_DEXCR_CTRL_CLEAR = 0x4 PR_PPC_DEXCR_CTRL_CLEAR = 0x4
PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC = 0x10 PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC = 0x10
PR_PPC_DEXCR_CTRL_EDITABLE = 0x1 PR_PPC_DEXCR_CTRL_EDITABLE = 0x1
@ -2592,6 +2606,7 @@ const (
PR_SET_PTRACER = 0x59616d61 PR_SET_PTRACER = 0x59616d61
PR_SET_SECCOMP = 0x16 PR_SET_SECCOMP = 0x16
PR_SET_SECUREBITS = 0x1c PR_SET_SECUREBITS = 0x1c
PR_SET_SHADOW_STACK_STATUS = 0x4b
PR_SET_SPECULATION_CTRL = 0x35 PR_SET_SPECULATION_CTRL = 0x35
PR_SET_SYSCALL_USER_DISPATCH = 0x3b PR_SET_SYSCALL_USER_DISPATCH = 0x3b
PR_SET_TAGGED_ADDR_CTRL = 0x37 PR_SET_TAGGED_ADDR_CTRL = 0x37
@ -2602,6 +2617,9 @@ const (
PR_SET_UNALIGN = 0x6 PR_SET_UNALIGN = 0x6
PR_SET_VMA = 0x53564d41 PR_SET_VMA = 0x53564d41
PR_SET_VMA_ANON_NAME = 0x0 PR_SET_VMA_ANON_NAME = 0x0
PR_SHADOW_STACK_ENABLE = 0x1
PR_SHADOW_STACK_PUSH = 0x4
PR_SHADOW_STACK_WRITE = 0x2
PR_SME_GET_VL = 0x40 PR_SME_GET_VL = 0x40
PR_SME_SET_VL = 0x3f PR_SME_SET_VL = 0x3f
PR_SME_SET_VL_ONEXEC = 0x40000 PR_SME_SET_VL_ONEXEC = 0x40000
@ -2911,7 +2929,6 @@ const (
RTM_NEWNEXTHOP = 0x68 RTM_NEWNEXTHOP = 0x68
RTM_NEWNEXTHOPBUCKET = 0x74 RTM_NEWNEXTHOPBUCKET = 0x74
RTM_NEWNSID = 0x58 RTM_NEWNSID = 0x58
RTM_NEWNVLAN = 0x70
RTM_NEWPREFIX = 0x34 RTM_NEWPREFIX = 0x34
RTM_NEWQDISC = 0x24 RTM_NEWQDISC = 0x24
RTM_NEWROUTE = 0x18 RTM_NEWROUTE = 0x18
@ -2920,6 +2937,7 @@ const (
RTM_NEWTCLASS = 0x28 RTM_NEWTCLASS = 0x28
RTM_NEWTFILTER = 0x2c RTM_NEWTFILTER = 0x2c
RTM_NEWTUNNEL = 0x78 RTM_NEWTUNNEL = 0x78
RTM_NEWVLAN = 0x70
RTM_NR_FAMILIES = 0x1b RTM_NR_FAMILIES = 0x1b
RTM_NR_MSGTYPES = 0x6c RTM_NR_MSGTYPES = 0x6c
RTM_SETDCB = 0x4f RTM_SETDCB = 0x4f

View File

@ -116,6 +116,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -304,6 +306,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103

View File

@ -116,6 +116,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -305,6 +307,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -310,6 +312,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103

View File

@ -109,6 +109,7 @@ const (
F_SETOWN = 0x8 F_SETOWN = 0x8
F_UNLCK = 0x2 F_UNLCK = 0x2
F_WRLCK = 0x1 F_WRLCK = 0x1
GCS_MAGIC = 0x47435300
HIDIOCGRAWINFO = 0x80084803 HIDIOCGRAWINFO = 0x80084803
HIDIOCGRDESC = 0x90044802 HIDIOCGRDESC = 0x90044802
HIDIOCGRDESCSIZE = 0x80044801 HIDIOCGRDESCSIZE = 0x80044801
@ -119,6 +120,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -302,6 +305,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103

View File

@ -116,6 +116,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -297,6 +299,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x80 IN_NONBLOCK = 0x80
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xfffffff
IPV6_FLOWLABEL_MASK = 0xfffff
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -303,6 +305,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x80 IN_NONBLOCK = 0x80
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xfffffff
IPV6_FLOWLABEL_MASK = 0xfffff
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -303,6 +305,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x80 IN_NONBLOCK = 0x80
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -303,6 +305,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x80 IN_NONBLOCK = 0x80
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -303,6 +305,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xfffffff
IPV6_FLOWLABEL_MASK = 0xfffff
ISIG = 0x80 ISIG = 0x80
IUCLC = 0x1000 IUCLC = 0x1000
IXOFF = 0x400 IXOFF = 0x400
@ -358,6 +360,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xfffffff
IPV6_FLOWLABEL_MASK = 0xfffff
ISIG = 0x80 ISIG = 0x80
IUCLC = 0x1000 IUCLC = 0x1000
IXOFF = 0x400 IXOFF = 0x400
@ -362,6 +364,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x80 ISIG = 0x80
IUCLC = 0x1000 IUCLC = 0x1000
IXOFF = 0x400 IXOFF = 0x400
@ -362,6 +364,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -294,6 +296,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103

View File

@ -115,6 +115,8 @@ const (
IN_CLOEXEC = 0x80000 IN_CLOEXEC = 0x80000
IN_NONBLOCK = 0x800 IN_NONBLOCK = 0x800
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
IPV6_FLOWINFO_MASK = 0xfffffff
IPV6_FLOWLABEL_MASK = 0xfffff
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -366,6 +368,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x36 SCM_TIMESTAMPING_OPT_STATS = 0x36
SCM_TIMESTAMPING_PKTINFO = 0x3a SCM_TIMESTAMPING_PKTINFO = 0x3a
SCM_TIMESTAMPNS = 0x23 SCM_TIMESTAMPNS = 0x23
SCM_TS_OPT_ID = 0x51
SCM_TXTIME = 0x3d SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29 SCM_WIFI_STATUS = 0x29
SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x40182103

View File

@ -119,6 +119,8 @@ const (
IN_CLOEXEC = 0x400000 IN_CLOEXEC = 0x400000
IN_NONBLOCK = 0x4000 IN_NONBLOCK = 0x4000
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9
IPV6_FLOWINFO_MASK = 0xfffffff
IPV6_FLOWLABEL_MASK = 0xfffff
ISIG = 0x1 ISIG = 0x1
IUCLC = 0x200 IUCLC = 0x200
IXOFF = 0x1000 IXOFF = 0x1000
@ -357,6 +359,7 @@ const (
SCM_TIMESTAMPING_OPT_STATS = 0x38 SCM_TIMESTAMPING_OPT_STATS = 0x38
SCM_TIMESTAMPING_PKTINFO = 0x3c SCM_TIMESTAMPING_PKTINFO = 0x3c
SCM_TIMESTAMPNS = 0x21 SCM_TIMESTAMPNS = 0x21
SCM_TS_OPT_ID = 0x5a
SCM_TXTIME = 0x3f SCM_TXTIME = 0x3f
SCM_WIFI_STATUS = 0x25 SCM_WIFI_STATUS = 0x25
SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103 SECCOMP_IOCTL_NOTIF_ADDFD = 0x80182103

View File

@ -141,6 +141,16 @@ import (
//go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so" //go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so"
//go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so" //go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so"
//go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so" //go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so"
//go:cgo_import_dynamic libc_getpeerucred getpeerucred "libc.so"
//go:cgo_import_dynamic libc_ucred_get ucred_get "libc.so"
//go:cgo_import_dynamic libc_ucred_geteuid ucred_geteuid "libc.so"
//go:cgo_import_dynamic libc_ucred_getegid ucred_getegid "libc.so"
//go:cgo_import_dynamic libc_ucred_getruid ucred_getruid "libc.so"
//go:cgo_import_dynamic libc_ucred_getrgid ucred_getrgid "libc.so"
//go:cgo_import_dynamic libc_ucred_getsuid ucred_getsuid "libc.so"
//go:cgo_import_dynamic libc_ucred_getsgid ucred_getsgid "libc.so"
//go:cgo_import_dynamic libc_ucred_getpid ucred_getpid "libc.so"
//go:cgo_import_dynamic libc_ucred_free ucred_free "libc.so"
//go:cgo_import_dynamic libc_port_create port_create "libc.so" //go:cgo_import_dynamic libc_port_create port_create "libc.so"
//go:cgo_import_dynamic libc_port_associate port_associate "libc.so" //go:cgo_import_dynamic libc_port_associate port_associate "libc.so"
//go:cgo_import_dynamic libc_port_dissociate port_dissociate "libc.so" //go:cgo_import_dynamic libc_port_dissociate port_dissociate "libc.so"
@ -280,6 +290,16 @@ import (
//go:linkname procgetpeername libc_getpeername //go:linkname procgetpeername libc_getpeername
//go:linkname procsetsockopt libc_setsockopt //go:linkname procsetsockopt libc_setsockopt
//go:linkname procrecvfrom libc_recvfrom //go:linkname procrecvfrom libc_recvfrom
//go:linkname procgetpeerucred libc_getpeerucred
//go:linkname procucred_get libc_ucred_get
//go:linkname procucred_geteuid libc_ucred_geteuid
//go:linkname procucred_getegid libc_ucred_getegid
//go:linkname procucred_getruid libc_ucred_getruid
//go:linkname procucred_getrgid libc_ucred_getrgid
//go:linkname procucred_getsuid libc_ucred_getsuid
//go:linkname procucred_getsgid libc_ucred_getsgid
//go:linkname procucred_getpid libc_ucred_getpid
//go:linkname procucred_free libc_ucred_free
//go:linkname procport_create libc_port_create //go:linkname procport_create libc_port_create
//go:linkname procport_associate libc_port_associate //go:linkname procport_associate libc_port_associate
//go:linkname procport_dissociate libc_port_dissociate //go:linkname procport_dissociate libc_port_dissociate
@ -420,6 +440,16 @@ var (
procgetpeername, procgetpeername,
procsetsockopt, procsetsockopt,
procrecvfrom, procrecvfrom,
procgetpeerucred,
procucred_get,
procucred_geteuid,
procucred_getegid,
procucred_getruid,
procucred_getrgid,
procucred_getsuid,
procucred_getsgid,
procucred_getpid,
procucred_free,
procport_create, procport_create,
procport_associate, procport_associate,
procport_dissociate, procport_dissociate,
@ -2029,6 +2059,90 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getpeerucred(fd uintptr, ucred *uintptr) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetpeerucred)), 2, uintptr(fd), uintptr(unsafe.Pointer(ucred)), 0, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGet(pid int) (ucred uintptr, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procucred_get)), 1, uintptr(pid), 0, 0, 0, 0, 0)
ucred = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGeteuid(ucred uintptr) (uid int) {
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procucred_geteuid)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGetegid(ucred uintptr) (gid int) {
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procucred_getegid)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGetruid(ucred uintptr) (uid int) {
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procucred_getruid)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGetrgid(ucred uintptr) (gid int) {
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procucred_getrgid)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGetsuid(ucred uintptr) (uid int) {
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procucred_getsuid)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGetsgid(ucred uintptr) (gid int) {
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procucred_getsgid)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredGetpid(ucred uintptr) (pid int) {
r0, _, _ := sysvicall6(uintptr(unsafe.Pointer(&procucred_getpid)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
pid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ucredFree(ucred uintptr) {
sysvicall6(uintptr(unsafe.Pointer(&procucred_free)), 1, uintptr(ucred), 0, 0, 0, 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func port_create() (n int, err error) { func port_create() (n int, err error) {
r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0) r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0)
n = int(r0) n = int(r0)

View File

@ -458,4 +458,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -381,4 +381,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -422,4 +422,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -325,4 +325,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -321,4 +321,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -442,4 +442,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_SET_SELF_ATTR = 4460
SYS_LSM_LIST_MODULES = 4461 SYS_LSM_LIST_MODULES = 4461
SYS_MSEAL = 4462 SYS_MSEAL = 4462
SYS_SETXATTRAT = 4463
SYS_GETXATTRAT = 4464
SYS_LISTXATTRAT = 4465
SYS_REMOVEXATTRAT = 4466
) )

View File

@ -372,4 +372,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_SET_SELF_ATTR = 5460
SYS_LSM_LIST_MODULES = 5461 SYS_LSM_LIST_MODULES = 5461
SYS_MSEAL = 5462 SYS_MSEAL = 5462
SYS_SETXATTRAT = 5463
SYS_GETXATTRAT = 5464
SYS_LISTXATTRAT = 5465
SYS_REMOVEXATTRAT = 5466
) )

View File

@ -372,4 +372,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 5460 SYS_LSM_SET_SELF_ATTR = 5460
SYS_LSM_LIST_MODULES = 5461 SYS_LSM_LIST_MODULES = 5461
SYS_MSEAL = 5462 SYS_MSEAL = 5462
SYS_SETXATTRAT = 5463
SYS_GETXATTRAT = 5464
SYS_LISTXATTRAT = 5465
SYS_REMOVEXATTRAT = 5466
) )

View File

@ -442,4 +442,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 4460 SYS_LSM_SET_SELF_ATTR = 4460
SYS_LSM_LIST_MODULES = 4461 SYS_LSM_LIST_MODULES = 4461
SYS_MSEAL = 4462 SYS_MSEAL = 4462
SYS_SETXATTRAT = 4463
SYS_GETXATTRAT = 4464
SYS_LISTXATTRAT = 4465
SYS_REMOVEXATTRAT = 4466
) )

View File

@ -449,4 +449,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -421,4 +421,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -421,4 +421,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -326,4 +326,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -387,4 +387,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -400,4 +400,8 @@ const (
SYS_LSM_SET_SELF_ATTR = 460 SYS_LSM_SET_SELF_ATTR = 460
SYS_LSM_LIST_MODULES = 461 SYS_LSM_LIST_MODULES = 461
SYS_MSEAL = 462 SYS_MSEAL = 462
SYS_SETXATTRAT = 463
SYS_GETXATTRAT = 464
SYS_LISTXATTRAT = 465
SYS_REMOVEXATTRAT = 466
) )

View File

@ -4747,7 +4747,7 @@ const (
NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_HINT = 0xc8
NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAC_MASK = 0xd7
NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca
NL80211_ATTR_MAX = 0x14c NL80211_ATTR_MAX = 0x14d
NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4
NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_CSA_COUNTERS = 0xce
NL80211_ATTR_MAX_MATCH_SETS = 0x85 NL80211_ATTR_MAX_MATCH_SETS = 0x85
@ -5519,7 +5519,7 @@ const (
NL80211_MNTR_FLAG_CONTROL = 0x3 NL80211_MNTR_FLAG_CONTROL = 0x3
NL80211_MNTR_FLAG_COOK_FRAMES = 0x5 NL80211_MNTR_FLAG_COOK_FRAMES = 0x5
NL80211_MNTR_FLAG_FCSFAIL = 0x1 NL80211_MNTR_FLAG_FCSFAIL = 0x1
NL80211_MNTR_FLAG_MAX = 0x6 NL80211_MNTR_FLAG_MAX = 0x7
NL80211_MNTR_FLAG_OTHER_BSS = 0x4 NL80211_MNTR_FLAG_OTHER_BSS = 0x4
NL80211_MNTR_FLAG_PLCPFAIL = 0x2 NL80211_MNTR_FLAG_PLCPFAIL = 0x2
NL80211_MPATH_FLAG_ACTIVE = 0x1 NL80211_MPATH_FLAG_ACTIVE = 0x1
@ -6174,3 +6174,5 @@ type SockDiagReq struct {
Family uint8 Family uint8
Protocol uint8 Protocol uint8
} }
const RTM_NEWNVLAN = 0x70

View File

@ -59,7 +59,7 @@ func (c CanonType) Parse(s string) (t Tag, err error) {
if changed { if changed {
tt.RemakeString() tt.RemakeString()
} }
return makeTag(tt), err return makeTag(tt), nil
} }
// Compose creates a Tag from individual parts, which may be of type Tag, Base, // Compose creates a Tag from individual parts, which may be of type Tag, Base,

View File

@ -59,10 +59,10 @@ import (
// //
// Unfortunately there are a number of open bugs related to // Unfortunately there are a number of open bugs related to
// interactions among the LoadMode bits: // interactions among the LoadMode bits:
// - https://github.com/golang/go/issues/56633 // - https://go.dev/issue/56633
// - https://github.com/golang/go/issues/56677 // - https://go.dev/issue/56677
// - https://github.com/golang/go/issues/58726 // - https://go.dev/issue/58726
// - https://github.com/golang/go/issues/63517 // - https://go.dev/issue/63517
type LoadMode int type LoadMode int
const ( const (
@ -141,6 +141,8 @@ const (
LoadAllSyntax = LoadSyntax | NeedDeps LoadAllSyntax = LoadSyntax | NeedDeps
// Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile. // Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile.
//
//go:fix inline
NeedExportsFile = NeedExportFile NeedExportsFile = NeedExportFile
) )
@ -161,7 +163,7 @@ type Config struct {
// If the user provides a logger, debug logging is enabled. // If the user provides a logger, debug logging is enabled.
// If the GOPACKAGESDEBUG environment variable is set to true, // If the GOPACKAGESDEBUG environment variable is set to true,
// but the logger is nil, default to log.Printf. // but the logger is nil, default to log.Printf.
Logf func(format string, args ...interface{}) Logf func(format string, args ...any)
// Dir is the directory in which to run the build system's query tool // Dir is the directory in which to run the build system's query tool
// that provides information about the packages. // that provides information about the packages.
@ -564,13 +566,13 @@ type ModuleError struct {
} }
func init() { func init() {
packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError { packagesinternal.GetDepsErrors = func(p any) []*packagesinternal.PackageError {
return p.(*Package).depsErrors return p.(*Package).depsErrors
} }
packagesinternal.SetModFile = func(config interface{}, value string) { packagesinternal.SetModFile = func(config any, value string) {
config.(*Config).modFile = value config.(*Config).modFile = value
} }
packagesinternal.SetModFlag = func(config interface{}, value string) { packagesinternal.SetModFlag = func(config any, value string) {
config.(*Config).modFlag = value config.(*Config).modFlag = value
} }
packagesinternal.TypecheckCgo = int(typecheckCgo) packagesinternal.TypecheckCgo = int(typecheckCgo)
@ -739,7 +741,7 @@ func newLoader(cfg *Config) *loader {
if debug { if debug {
ld.Config.Logf = log.Printf ld.Config.Logf = log.Printf
} else { } else {
ld.Config.Logf = func(format string, args ...interface{}) {} ld.Config.Logf = func(format string, args ...any) {}
} }
} }
if ld.Config.Mode == 0 { if ld.Config.Mode == 0 {

View File

@ -257,11 +257,14 @@ func (h hasher) hash(t types.Type) uint32 {
} }
tparams := t.TypeParams() tparams := t.TypeParams()
for i := range tparams.Len() { if n := tparams.Len(); n > 0 {
h.inGenericSig = true h.inGenericSig = true // affects constraints, params, and results
for i := range n {
tparam := tparams.At(i) tparam := tparams.At(i)
hash += 7 * h.hash(tparam.Constraint()) hash += 7 * h.hash(tparam.Constraint())
} }
}
return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results()) return hash + 3*h.hashTuple(t.Params()) + 5*h.hashTuple(t.Results())
@ -386,8 +389,13 @@ func (hasher) hashTypeName(tname *types.TypeName) uint32 {
// path, and whether or not it is a package-level typename. It // path, and whether or not it is a package-level typename. It
// is rare for a package to define multiple local types with // is rare for a package to define multiple local types with
// the same name.) // the same name.)
hash := uintptr(unsafe.Pointer(tname)) ptr := uintptr(unsafe.Pointer(tname))
if unsafe.Sizeof(ptr) == 8 {
hash := uint64(ptr)
return uint32(hash ^ (hash >> 32)) return uint32(hash ^ (hash >> 32))
} else {
return uint32(ptr)
}
} }
// shallowHash computes a hash of t without looking at any of its // shallowHash computes a hash of t without looking at any of its

View File

@ -32,7 +32,7 @@ func (k *Value) Format(w io.Writer, buf []byte, l label.Label) {
} }
// Get can be used to get a label for the key from a label.Map. // Get can be used to get a label for the key from a label.Map.
func (k *Value) Get(lm label.Map) interface{} { func (k *Value) Get(lm label.Map) any {
if t := lm.Find(k); t.Valid() { if t := lm.Find(k); t.Valid() {
return k.From(t) return k.From(t)
} }
@ -40,10 +40,10 @@ func (k *Value) Get(lm label.Map) interface{} {
} }
// From can be used to get a value from a Label. // From can be used to get a value from a Label.
func (k *Value) From(t label.Label) interface{} { return t.UnpackValue() } func (k *Value) From(t label.Label) any { return t.UnpackValue() }
// Of creates a new Label with this key and the supplied value. // Of creates a new Label with this key and the supplied value.
func (k *Value) Of(value interface{}) label.Label { return label.OfValue(k, value) } func (k *Value) Of(value any) label.Label { return label.OfValue(k, value) }
// Tag represents a key for tagging labels that have no value. // Tag represents a key for tagging labels that have no value.
// These are used when the existence of the label is the entire information it // These are used when the existence of the label is the entire information it

View File

@ -32,7 +32,7 @@ type Key interface {
type Label struct { type Label struct {
key Key key Key
packed uint64 packed uint64
untyped interface{} untyped any
} }
// Map is the interface to a collection of Labels indexed by key. // Map is the interface to a collection of Labels indexed by key.
@ -76,13 +76,13 @@ type mapChain struct {
// OfValue creates a new label from the key and value. // OfValue creates a new label from the key and value.
// This method is for implementing new key types, label creation should // This method is for implementing new key types, label creation should
// normally be done with the Of method of the key. // normally be done with the Of method of the key.
func OfValue(k Key, value interface{}) Label { return Label{key: k, untyped: value} } func OfValue(k Key, value any) Label { return Label{key: k, untyped: value} }
// UnpackValue assumes the label was built using LabelOfValue and returns the value // UnpackValue assumes the label was built using LabelOfValue and returns the value
// that was passed to that constructor. // that was passed to that constructor.
// This method is for implementing new key types, for type safety normal // This method is for implementing new key types, for type safety normal
// access should be done with the From method of the key. // access should be done with the From method of the key.
func (t Label) UnpackValue() interface{} { return t.untyped } func (t Label) UnpackValue() any { return t.untyped }
// Of64 creates a new label from a key and a uint64. This is often // Of64 creates a new label from a key and a uint64. This is often
// used for non uint64 values that can be packed into a uint64. // used for non uint64 values that can be packed into a uint64.

View File

@ -14,7 +14,7 @@ import (
"sync" "sync"
) )
func errorf(format string, args ...interface{}) { func errorf(format string, args ...any) {
panic(fmt.Sprintf(format, args...)) panic(fmt.Sprintf(format, args...))
} }

View File

@ -310,7 +310,7 @@ func IImportShallow(fset *token.FileSet, getPackages GetPackagesFunc, data []byt
} }
// ReportFunc is the type of a function used to report formatted bugs. // ReportFunc is the type of a function used to report formatted bugs.
type ReportFunc = func(string, ...interface{}) type ReportFunc = func(string, ...any)
// Current bundled export format version. Increase with each format change. // Current bundled export format version. Increase with each format change.
// 0: initial implementation // 0: initial implementation
@ -597,7 +597,7 @@ type filePositions struct {
needed []uint64 // unordered list of needed file offsets needed []uint64 // unordered list of needed file offsets
} }
func (p *iexporter) trace(format string, args ...interface{}) { func (p *iexporter) trace(format string, args ...any) {
if !trace { if !trace {
// Call sites should also be guarded, but having this check here allows // Call sites should also be guarded, but having this check here allows
// easily enabling/disabling debug trace statements. // easily enabling/disabling debug trace statements.
@ -1583,6 +1583,6 @@ func (e internalError) Error() string { return "gcimporter: " + string(e) }
// "internalErrorf" as the former is used for bugs, whose cause is // "internalErrorf" as the former is used for bugs, whose cause is
// internal inconsistency, whereas the latter is used for ordinary // internal inconsistency, whereas the latter is used for ordinary
// situations like bad input, whose cause is external. // situations like bad input, whose cause is external.
func internalErrorf(format string, args ...interface{}) error { func internalErrorf(format string, args ...any) error {
return internalError(fmt.Sprintf(format, args...)) return internalError(fmt.Sprintf(format, args...))
} }

View File

@ -400,7 +400,7 @@ type iimporter struct {
indent int // for tracing support indent int // for tracing support
} }
func (p *iimporter) trace(format string, args ...interface{}) { func (p *iimporter) trace(format string, args ...any) {
if !trace { if !trace {
// Call sites should also be guarded, but having this check here allows // Call sites should also be guarded, but having this check here allows
// easily enabling/disabling debug trace statements. // easily enabling/disabling debug trace statements.
@ -671,7 +671,9 @@ func (r *importReader) obj(name string) {
case varTag: case varTag:
typ := r.typ() typ := r.typ()
r.declare(types.NewVar(pos, r.currPkg, name, typ)) v := types.NewVar(pos, r.currPkg, name, typ)
typesinternal.SetVarKind(v, typesinternal.PackageVar)
r.declare(v)
default: default:
errorf("unexpected tag: %v", tag) errorf("unexpected tag: %v", tag)

View File

@ -14,6 +14,7 @@ import (
"golang.org/x/tools/internal/aliases" "golang.org/x/tools/internal/aliases"
"golang.org/x/tools/internal/pkgbits" "golang.org/x/tools/internal/pkgbits"
"golang.org/x/tools/internal/typesinternal"
) )
// A pkgReader holds the shared state for reading a unified IR package // A pkgReader holds the shared state for reading a unified IR package
@ -572,7 +573,8 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
sig := fn.Type().(*types.Signature) sig := fn.Type().(*types.Signature)
recv := types.NewVar(fn.Pos(), fn.Pkg(), "", named) recv := types.NewVar(fn.Pos(), fn.Pkg(), "", named)
methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignature(recv, sig.Params(), sig.Results(), sig.Variadic())) typesinternal.SetVarKind(recv, typesinternal.RecvVar)
methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignatureType(recv, nil, nil, sig.Params(), sig.Results(), sig.Variadic()))
} }
embeds := make([]types.Type, iface.NumEmbeddeds()) embeds := make([]types.Type, iface.NumEmbeddeds())
@ -619,7 +621,9 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) {
case pkgbits.ObjVar: case pkgbits.ObjVar:
pos := r.pos() pos := r.pos()
typ := r.typ() typ := r.typ()
declare(types.NewVar(pos, objPkg, objName, typ)) v := types.NewVar(pos, objPkg, objName, typ)
typesinternal.SetVarKind(v, typesinternal.PackageVar)
declare(v)
} }
} }

View File

@ -28,7 +28,7 @@ import (
"golang.org/x/tools/internal/event/label" "golang.org/x/tools/internal/event/label"
) )
// An Runner will run go command invocations and serialize // A Runner will run go command invocations and serialize
// them if it sees a concurrency error. // them if it sees a concurrency error.
type Runner struct { type Runner struct {
// once guards the runner initialization. // once guards the runner initialization.
@ -179,7 +179,7 @@ type Invocation struct {
CleanEnv bool CleanEnv bool
Env []string Env []string
WorkingDir string WorkingDir string
Logf func(format string, args ...interface{}) Logf func(format string, args ...any)
} }
// Postcondition: both error results have same nilness. // Postcondition: both error results have same nilness.
@ -388,7 +388,9 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
case err := <-resChan: case err := <-resChan:
return err return err
case <-timer.C: case <-timer.C:
HandleHangingGoCommand(startTime, cmd) // HandleHangingGoCommand terminates this process.
// Pass off resChan in case we can collect the command error.
handleHangingGoCommand(startTime, cmd, resChan)
case <-ctx.Done(): case <-ctx.Done():
} }
} else { } else {
@ -413,8 +415,6 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
} }
// Didn't shut down in response to interrupt. Kill it hard. // Didn't shut down in response to interrupt. Kill it hard.
// TODO(rfindley): per advice from bcmills@, it may be better to send SIGQUIT
// on certain platforms, such as unix.
if err := cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) && debug { if err := cmd.Process.Kill(); err != nil && !errors.Is(err, os.ErrProcessDone) && debug {
log.Printf("error killing the Go command: %v", err) log.Printf("error killing the Go command: %v", err)
} }
@ -422,15 +422,17 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) (err error) {
return <-resChan return <-resChan
} }
func HandleHangingGoCommand(start time.Time, cmd *exec.Cmd) { // handleHangingGoCommand outputs debugging information to help diagnose the
// cause of a hanging Go command, and then exits with log.Fatalf.
func handleHangingGoCommand(start time.Time, cmd *exec.Cmd, resChan chan error) {
switch runtime.GOOS { switch runtime.GOOS {
case "linux", "darwin", "freebsd", "netbsd": case "linux", "darwin", "freebsd", "netbsd", "openbsd":
fmt.Fprintln(os.Stderr, `DETECTED A HANGING GO COMMAND fmt.Fprintln(os.Stderr, `DETECTED A HANGING GO COMMAND
The gopls test runner has detected a hanging go command. In order to debug The gopls test runner has detected a hanging go command. In order to debug
this, the output of ps and lsof/fstat is printed below. this, the output of ps and lsof/fstat is printed below.
See golang/go#54461 for more details.`) See golang/go#54461 for more details.`)
fmt.Fprintln(os.Stderr, "\nps axo ppid,pid,command:") fmt.Fprintln(os.Stderr, "\nps axo ppid,pid,command:")
fmt.Fprintln(os.Stderr, "-------------------------") fmt.Fprintln(os.Stderr, "-------------------------")
@ -438,7 +440,7 @@ See golang/go#54461 for more details.`)
psCmd.Stdout = os.Stderr psCmd.Stdout = os.Stderr
psCmd.Stderr = os.Stderr psCmd.Stderr = os.Stderr
if err := psCmd.Run(); err != nil { if err := psCmd.Run(); err != nil {
panic(fmt.Sprintf("running ps: %v", err)) log.Printf("Handling hanging Go command: running ps: %v", err)
} }
listFiles := "lsof" listFiles := "lsof"
@ -452,10 +454,24 @@ See golang/go#54461 for more details.`)
listFilesCmd.Stdout = os.Stderr listFilesCmd.Stdout = os.Stderr
listFilesCmd.Stderr = os.Stderr listFilesCmd.Stderr = os.Stderr
if err := listFilesCmd.Run(); err != nil { if err := listFilesCmd.Run(); err != nil {
panic(fmt.Sprintf("running %s: %v", listFiles, err)) log.Printf("Handling hanging Go command: running %s: %v", listFiles, err)
}
// Try to extract information about the slow go process by issuing a SIGQUIT.
if err := cmd.Process.Signal(sigStuckProcess); err == nil {
select {
case err := <-resChan:
stderr := "not a bytes.Buffer"
if buf, _ := cmd.Stderr.(*bytes.Buffer); buf != nil {
stderr = buf.String()
}
log.Printf("Quit hanging go command:\n\terr:%v\n\tstderr:\n%v\n\n", err, stderr)
case <-time.After(5 * time.Second):
}
} else {
log.Printf("Sending signal %d to hanging go command: %v", sigStuckProcess, err)
} }
} }
panic(fmt.Sprintf("detected hanging go command (golang/go#54461); waited %s\n\tcommand:%s\n\tpid:%d", time.Since(start), cmd, cmd.Process.Pid)) log.Fatalf("detected hanging go command (golang/go#54461); waited %s\n\tcommand:%s\n\tpid:%d", time.Since(start), cmd, cmd.Process.Pid)
} }
func cmdDebugStr(cmd *exec.Cmd) string { func cmdDebugStr(cmd *exec.Cmd) string {

View File

@ -0,0 +1,13 @@
// Copyright 2025 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 !unix
package gocommand
import "os"
// sigStuckProcess is the signal to send to kill a hanging subprocess.
// On Unix we send SIGQUIT, but on non-Unix we only have os.Kill.
var sigStuckProcess = os.Kill

View File

@ -0,0 +1,13 @@
// Copyright 2025 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 unix
package gocommand
import "syscall"
// Sigstuckprocess is the signal to send to kill a hanging subprocess.
// Send SIGQUIT to get a stack trace.
var sigStuckProcess = syscall.SIGQUIT

View File

@ -5,7 +5,7 @@
// Package packagesinternal exposes internal-only fields from go/packages. // Package packagesinternal exposes internal-only fields from go/packages.
package packagesinternal package packagesinternal
var GetDepsErrors = func(p interface{}) []*PackageError { return nil } var GetDepsErrors = func(p any) []*PackageError { return nil }
type PackageError struct { type PackageError struct {
ImportStack []string // shortest path from package named on command line to this one ImportStack []string // shortest path from package named on command line to this one
@ -16,5 +16,5 @@ type PackageError struct {
var TypecheckCgo int var TypecheckCgo int
var DepsErrors int // must be set as a LoadMode to call GetDepsErrors var DepsErrors int // must be set as a LoadMode to call GetDepsErrors
var SetModFlag = func(config interface{}, value string) {} var SetModFlag = func(config any, value string) {}
var SetModFile = func(config interface{}, value string) {} var SetModFile = func(config any, value string) {}

359
vendor/golang.org/x/tools/internal/stdlib/deps.go generated vendored Normal file
View File

@ -0,0 +1,359 @@
// Copyright 2025 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.
// Code generated by generate.go. DO NOT EDIT.
package stdlib
type pkginfo struct {
name string
deps string // list of indices of dependencies, as varint-encoded deltas
}
var deps = [...]pkginfo{
{"archive/tar", "\x03k\x03E5\x01\v\x01#\x01\x01\x02\x05\t\x02\x01\x02\x02\v"},
{"archive/zip", "\x02\x04a\a\x16\x0205\x01+\x05\x01\x10\x03\x02\r\x04"},
{"bufio", "\x03k}E\x13"},
{"bytes", "n+R\x03\fG\x02\x02"},
{"cmp", ""},
{"compress/bzip2", "\x02\x02\xe7\x01B"},
{"compress/flate", "\x02l\x03z\r\x024\x01\x03"},
{"compress/gzip", "\x02\x04a\a\x03\x15eT"},
{"compress/lzw", "\x02l\x03z"},
{"compress/zlib", "\x02\x04a\a\x03\x13\x01f"},
{"container/heap", "\xae\x02"},
{"container/list", ""},
{"container/ring", ""},
{"context", "n\\h\x01\f"},
{"crypto", "\x84\x01gD"},
{"crypto/aes", "\x10\n\a\x8e\x02"},
{"crypto/cipher", "\x03\x1e\x01\x01\x1d\x11\x1d,Q"},
{"crypto/des", "\x10\x13\x1d.,\x95\x01\x03"},
{"crypto/dsa", "@\x04*}\x0e"},
{"crypto/ecdh", "\x03\v\f\x0e\x04\x14\x04\r\x1d}"},
{"crypto/ecdsa", "\x0e\x05\x03\x04\x01\x0e\x16\x01\x04\f\x01\x1d}\x0e\x04K\x01"},
{"crypto/ed25519", "\x0e\x1c\x16\n\a\x1d}D"},
{"crypto/elliptic", "0>}\x0e9"},
{"crypto/fips140", " \x05\x91\x01"},
{"crypto/hkdf", "-\x12\x01.\x16"},
{"crypto/hmac", "\x1a\x14\x11\x01\x113"},
{"crypto/internal/boring", "\x0e\x02\rg"},
{"crypto/internal/boring/bbig", "\x1a\xdf\x01L"},
{"crypto/internal/boring/bcache", "\xb3\x02\x12"},
{"crypto/internal/boring/sig", ""},
{"crypto/internal/cryptotest", "\x03\r\n)\x0e\x1a\x06\x13\x12#\a\t\x11\x11\x11\x1b\x01\f\f\x05\n"},
{"crypto/internal/entropy", "E"},
{"crypto/internal/fips140", ">0}9\f\x15"},
{"crypto/internal/fips140/aes", "\x03\x1d\x03\x02\x13\x04\x01\x01\x05+\x8c\x015"},
{"crypto/internal/fips140/aes/gcm", " \x01\x02\x02\x02\x11\x04\x01\x06+\x8a\x01"},
{"crypto/internal/fips140/alias", "\xc5\x02"},
{"crypto/internal/fips140/bigmod", "%\x17\x01\x06+\x8c\x01"},
{"crypto/internal/fips140/check", " \x0e\x06\b\x02\xad\x01Z"},
{"crypto/internal/fips140/check/checktest", "%\xff\x01!"},
{"crypto/internal/fips140/drbg", "\x03\x1c\x01\x01\x04\x13\x04\b\x01)}\x0f8"},
{"crypto/internal/fips140/ecdh", "\x03\x1d\x05\x02\t\f2}\x0f8"},
{"crypto/internal/fips140/ecdsa", "\x03\x1d\x04\x01\x02\a\x02\x068}G"},
{"crypto/internal/fips140/ed25519", "\x03\x1d\x05\x02\x04\v8\xc1\x01\x03"},
{"crypto/internal/fips140/edwards25519", "%\a\f\x042\x8c\x018"},
{"crypto/internal/fips140/edwards25519/field", "%\x13\x042\x8c\x01"},
{"crypto/internal/fips140/hkdf", "\x03\x1d\x05\t\x06:"},
{"crypto/internal/fips140/hmac", "\x03\x1d\x14\x01\x018"},
{"crypto/internal/fips140/mlkem", "\x03\x1d\x05\x02\x0e\x03\x042"},
{"crypto/internal/fips140/nistec", "%\f\a\x042\x8c\x01*\x0e\x13"},
{"crypto/internal/fips140/nistec/fiat", "%\x136\x8c\x01"},
{"crypto/internal/fips140/pbkdf2", "\x03\x1d\x05\t\x06:"},
{"crypto/internal/fips140/rsa", "\x03\x1d\x04\x01\x02\r\x01\x01\x026}G"},
{"crypto/internal/fips140/sha256", "\x03\x1d\x1c\x01\x06+\x8c\x01"},
{"crypto/internal/fips140/sha3", "\x03\x1d\x18\x04\x011\x8c\x01K"},
{"crypto/internal/fips140/sha512", "\x03\x1d\x1c\x01\x06+\x8c\x01"},
{"crypto/internal/fips140/ssh", " \x05"},
{"crypto/internal/fips140/subtle", "#\x19\xbe\x01"},
{"crypto/internal/fips140/tls12", "\x03\x1d\x05\t\x06\x028"},
{"crypto/internal/fips140/tls13", "\x03\x1d\x05\b\a\b2"},
{"crypto/internal/fips140deps", ""},
{"crypto/internal/fips140deps/byteorder", "\x9a\x01"},
{"crypto/internal/fips140deps/cpu", "\xae\x01\a"},
{"crypto/internal/fips140deps/godebug", "\xb6\x01"},
{"crypto/internal/fips140hash", "5\x1a5\xc1\x01"},
{"crypto/internal/fips140only", "'\r\x01\x01N25"},
{"crypto/internal/fips140test", ""},
{"crypto/internal/hpke", "\x0e\x01\x01\x03\x1a\x1d$,`M"},
{"crypto/internal/impl", "\xb0\x02"},
{"crypto/internal/randutil", "\xeb\x01\x12"},
{"crypto/internal/sysrand", "\xd7\x01@\x1b\x01\f\x06"},
{"crypto/internal/sysrand/internal/seccomp", "n"},
{"crypto/md5", "\x0e2.\x16\x16`"},
{"crypto/mlkem", "/"},
{"crypto/pbkdf2", "2\r\x01.\x16"},
{"crypto/rand", "\x1a\x06\a\x19\x04\x01)}\x0eL"},
{"crypto/rc4", "#\x1d.\xc1\x01"},
{"crypto/rsa", "\x0e\f\x01\t\x0f\f\x01\x04\x06\a\x1d\x03\x1325\r\x01"},
{"crypto/sha1", "\x0e\f&.\x16\x16\x14L"},
{"crypto/sha256", "\x0e\f\x1aP"},
{"crypto/sha3", "\x0e'O\xc1\x01"},
{"crypto/sha512", "\x0e\f\x1cN"},
{"crypto/subtle", "8\x98\x01T"},
{"crypto/tls", "\x03\b\x02\x01\x01\x01\x01\x02\x01\x01\x01\x03\x01\a\x01\v\x02\n\x01\b\x05\x03\x01\x01\x01\x01\x02\x01\x02\x01\x18\x02\x03\x13\x16\x14\b5\x16\x16\r\t\x01\x01\x01\x02\x01\f\x06\x02\x01"},
{"crypto/tls/internal/fips140tls", " \x93\x02"},
{"crypto/x509", "\x03\v\x01\x01\x01\x01\x01\x01\x01\x011\x03\x02\x01\x01\x02\x05\x01\x0e\x06\x02\x02\x03E5\x03\t\x01\x01\x01\a\x10\x05\t\x05\v\x01\x02\r\x02\x01\x01\x02\x03\x01"},
{"crypto/x509/internal/macos", "\x03k'\x8f\x01\v\x10\x06"},
{"crypto/x509/pkix", "d\x06\a\x88\x01F"},
{"database/sql", "\x03\nK\x16\x03z\f\x06\"\x05\t\x02\x03\x01\f\x02\x02\x02"},
{"database/sql/driver", "\ra\x03\xae\x01\x10\x10"},
{"debug/buildinfo", "\x03X\x02\x01\x01\b\a\x03`\x18\x02\x01+\x10\x1e"},
{"debug/dwarf", "\x03d\a\x03z1\x12\x01\x01"},
{"debug/elf", "\x03\x06Q\r\a\x03`\x19\x01,\x18\x01\x15"},
{"debug/gosym", "\x03d\n\xbd\x01\x01\x01\x02"},
{"debug/macho", "\x03\x06Q\r\n`\x1a,\x18\x01"},
{"debug/pe", "\x03\x06Q\r\a\x03`\x1a,\x18\x01\x15"},
{"debug/plan9obj", "g\a\x03`\x1a,"},
{"embed", "n+:\x18\x01S"},
{"embed/internal/embedtest", ""},
{"encoding", ""},
{"encoding/ascii85", "\xeb\x01D"},
{"encoding/asn1", "\x03k\x03\x87\x01\x01&\x0e\x02\x01\x0f\x03\x01"},
{"encoding/base32", "\xeb\x01B\x02"},
{"encoding/base64", "\x9a\x01QB\x02"},
{"encoding/binary", "n}\r'\x0e\x05"},
{"encoding/csv", "\x02\x01k\x03zE\x11\x02"},
{"encoding/gob", "\x02`\x05\a\x03`\x1a\f\x01\x02\x1d\b\x13\x01\x0e\x02"},
{"encoding/hex", "n\x03zB\x03"},
{"encoding/json", "\x03\x01^\x04\b\x03z\r'\x0e\x02\x01\x02\x0f\x01\x01\x02"},
{"encoding/pem", "\x03c\b}B\x03"},
{"encoding/xml", "\x02\x01_\f\x03z4\x05\v\x01\x02\x0f\x02"},
{"errors", "\xca\x01{"},
{"expvar", "kK9\t\n\x15\r\t\x02\x03\x01\x10"},
{"flag", "b\f\x03z,\b\x05\t\x02\x01\x0f"},
{"fmt", "nE8\r\x1f\b\x0e\x02\x03\x11"},
{"go/ast", "\x03\x01m\x0f\x01j\x03)\b\x0e\x02\x01"},
{"go/ast/internal/tests", ""},
{"go/build", "\x02\x01k\x03\x01\x03\x02\a\x02\x01\x17\x1e\x04\x02\t\x14\x12\x01+\x01\x04\x01\a\t\x02\x01\x11\x02\x02"},
{"go/build/constraint", "n\xc1\x01\x01\x11\x02"},
{"go/constant", "q\x10w\x01\x015\x01\x02\x11"},
{"go/doc", "\x04m\x01\x06\t=-1\x11\x02\x01\x11\x02"},
{"go/doc/comment", "\x03n\xbc\x01\x01\x01\x01\x11\x02"},
{"go/format", "\x03n\x01\f\x01\x02jE"},
{"go/importer", "t\a\x01\x01\x04\x01i9"},
{"go/internal/gccgoimporter", "\x02\x01X\x13\x03\x05\v\x01g\x02,\x01\x05\x12\x01\v\b"},
{"go/internal/gcimporter", "\x02o\x10\x01/\x05\x0e',\x16\x03\x02"},
{"go/internal/srcimporter", "q\x01\x02\n\x03\x01i,\x01\x05\x13\x02\x13"},
{"go/parser", "\x03k\x03\x01\x03\v\x01j\x01+\x06\x13"},
{"go/printer", "q\x01\x03\x03\tj\r\x1f\x16\x02\x01\x02\n\x05\x02"},
{"go/scanner", "\x03n\x10j2\x11\x01\x12\x02"},
{"go/token", "\x04m\xbc\x01\x02\x03\x01\x0e\x02"},
{"go/types", "\x03\x01\x06d\x03\x01\x04\b\x03\x02\x15\x1e\x06+\x04\x03\n%\a\t\x01\x01\x01\x02\x01\x0e\x02\x02"},
{"go/version", "\xbb\x01u"},
{"hash", "\xeb\x01"},
{"hash/adler32", "n\x16\x16"},
{"hash/crc32", "n\x16\x16\x14\x84\x01\x01"},
{"hash/crc64", "n\x16\x16\x98\x01"},
{"hash/fnv", "n\x16\x16`"},
{"hash/maphash", "\x95\x01\x05\x1b\x03@M"},
{"html", "\xb0\x02\x02\x11"},
{"html/template", "\x03h\x06\x19,5\x01\v \x05\x01\x02\x03\r\x01\x02\v\x01\x03\x02"},
{"image", "\x02l\x1f^\x0f5\x03\x01"},
{"image/color", ""},
{"image/color/palette", "\x8d\x01"},
{"image/draw", "\x8c\x01\x01\x04"},
{"image/gif", "\x02\x01\x05f\x03\x1b\x01\x01\x01\vQ"},
{"image/internal/imageutil", "\x8c\x01"},
{"image/jpeg", "\x02l\x1e\x01\x04Z"},
{"image/png", "\x02\a^\n\x13\x02\x06\x01^D"},
{"index/suffixarray", "\x03d\a}\r*\v\x01"},
{"internal/abi", "\xb5\x01\x90\x01"},
{"internal/asan", "\xc5\x02"},
{"internal/bisect", "\xa4\x02\x0e\x01"},
{"internal/buildcfg", "qG_\x06\x02\x05\v\x01"},
{"internal/bytealg", "\xae\x01\x97\x01"},
{"internal/byteorder", ""},
{"internal/cfg", ""},
{"internal/chacha8rand", "\x9a\x01\x1b\x90\x01"},
{"internal/copyright", ""},
{"internal/coverage", ""},
{"internal/coverage/calloc", ""},
{"internal/coverage/cfile", "k\x06\x17\x16\x01\x02\x01\x01\x01\x01\x01\x01\x01$\x01\x1e,\x06\a\v\x01\x03\f\x06"},
{"internal/coverage/cformat", "\x04m-\x04I\f6\x01\x02\f"},
{"internal/coverage/cmerge", "q-Z"},
{"internal/coverage/decodecounter", "g\n-\v\x02@,\x18\x16"},
{"internal/coverage/decodemeta", "\x02e\n\x17\x16\v\x02@,"},
{"internal/coverage/encodecounter", "\x02e\n-\f\x01\x02>\f \x16"},
{"internal/coverage/encodemeta", "\x02\x01d\n\x13\x04\x16\r\x02>,."},
{"internal/coverage/pods", "\x04m-y\x06\x05\v\x02\x01"},
{"internal/coverage/rtcov", "\xc5\x02"},
{"internal/coverage/slicereader", "g\nzZ"},
{"internal/coverage/slicewriter", "qz"},
{"internal/coverage/stringtab", "q8\x04>"},
{"internal/coverage/test", ""},
{"internal/coverage/uleb128", ""},
{"internal/cpu", "\xc5\x02"},
{"internal/dag", "\x04m\xbc\x01\x03"},
{"internal/diff", "\x03n\xbd\x01\x02"},
{"internal/exportdata", "\x02\x01k\x03\x03]\x1a,\x01\x05\x12\x01\x02"},
{"internal/filepathlite", "n+:\x19A"},
{"internal/fmtsort", "\x04\x9b\x02\x0e"},
{"internal/fuzz", "\x03\nA\x19\x04\x03\x03\x01\f\x0355\r\x02\x1d\x01\x05\x02\x05\v\x01\x02\x01\x01\v\x04\x02"},
{"internal/goarch", ""},
{"internal/godebug", "\x97\x01 {\x01\x12"},
{"internal/godebugs", ""},
{"internal/goexperiment", ""},
{"internal/goos", ""},
{"internal/goroot", "\x97\x02\x01\x05\x13\x02"},
{"internal/gover", "\x04"},
{"internal/goversion", ""},
{"internal/itoa", ""},
{"internal/lazyregexp", "\x97\x02\v\x0e\x02"},
{"internal/lazytemplate", "\xeb\x01,\x19\x02\v"},
{"internal/msan", "\xc5\x02"},
{"internal/nettrace", ""},
{"internal/obscuretestdata", "f\x85\x01,"},
{"internal/oserror", "n"},
{"internal/pkgbits", "\x03K\x19\a\x03\x05\vj\x0e\x1e\r\v\x01"},
{"internal/platform", ""},
{"internal/poll", "nO\x1a\x149\x0e\x01\x01\v\x06"},
{"internal/profile", "\x03\x04g\x03z7\f\x01\x01\x0f"},
{"internal/profilerecord", ""},
{"internal/race", "\x95\x01\xb0\x01"},
{"internal/reflectlite", "\x95\x01 3<!"},
{"internal/routebsd", "n,w\x13\x10\x11"},
{"internal/runtime/atomic", "\xae\x01\x97\x01"},
{"internal/runtime/exithook", "\xcc\x01y"},
{"internal/runtime/maps", "\x95\x01\x01\x1f\v\t\x06\x01u"},
{"internal/runtime/math", "\xb5\x01"},
{"internal/runtime/sys", "\xae\x01\a\x04"},
{"internal/saferio", "\xeb\x01Z"},
{"internal/singleflight", "\xb2\x02"},
{"internal/stringslite", "\x99\x01\xac\x01"},
{"internal/sync", "\x95\x01 \x14j\x12"},
{"internal/synctest", "\xc5\x02"},
{"internal/syscall/execenv", "\xb4\x02"},
{"internal/syscall/unix", "\x95\x01\x8f\x01\x10\x11"},
{"internal/sysinfo", "\xae\x01\x84\x01\x02"},
{"internal/syslist", ""},
{"internal/testenv", "\x03\na\x02\x01*\x1a\x10'+\x01\x05\a\v\x01\x02\x02\x01\n"},
{"internal/testlog", "\xb2\x02\x01\x12"},
{"internal/testpty", "n\x03f@\x1d"},
{"internal/trace", "\x02\x01\x01\x06]\a\x03n\x03\x03\x06\x03\n5\x01\x02\x0f\x06"},
{"internal/trace/internal/testgen", "\x03d\nl\x03\x02\x03\x011\v\x0e"},
{"internal/trace/internal/tracev1", "\x03\x01c\a\x03t\x06\r5\x01"},
{"internal/trace/raw", "\x02e\nq\x03\x06D\x01\x11"},
{"internal/trace/testtrace", "\x02\x01k\x03l\x03\x06\x057\v\x02\x01"},
{"internal/trace/tracev2", ""},
{"internal/trace/traceviewer", "\x02^\v\x06\x1a<\x16\a\a\x04\t\n\x15\x01\x05\a\v\x01\x02\r"},
{"internal/trace/traceviewer/format", ""},
{"internal/trace/version", "qq\t"},
{"internal/txtar", "\x03n\xa6\x01\x19"},
{"internal/types/errors", "\xaf\x02"},
{"internal/unsafeheader", "\xc5\x02"},
{"internal/xcoff", "Z\r\a\x03`\x1a,\x18\x01"},
{"internal/zstd", "g\a\x03z\x0f"},
{"io", "n\xc4\x01"},
{"io/fs", "n+*(1\x11\x12\x04"},
{"io/ioutil", "\xeb\x01\x01+\x16\x03"},
{"iter", "\xc9\x01[!"},
{"log", "qz\x05'\r\x0e\x01\f"},
{"log/internal", ""},
{"log/slog", "\x03\nU\t\x03\x03z\x04\x01\x02\x02\x04'\x05\t\x02\x01\x02\x01\f\x02\x02\x02"},
{"log/slog/internal", ""},
{"log/slog/internal/benchmarks", "\ra\x03z\x06\x03;\x10"},
{"log/slog/internal/buffer", "\xb2\x02"},
{"log/slog/internal/slogtest", "\xf1\x01"},
{"log/syslog", "n\x03~\x12\x16\x19\x02\r"},
{"maps", "\xee\x01W"},
{"math", "\xfa\x01K"},
{"math/big", "\x03k\x03)Q\r\x02\x021\x02\x01\x02\x13"},
{"math/bits", "\xc5\x02"},
{"math/cmplx", "\xf8\x01\x02"},
{"math/rand", "\xb6\x01B:\x01\x12"},
{"math/rand/v2", "n,\x02\\\x02K"},
{"mime", "\x02\x01c\b\x03z\f \x16\x03\x02\x0f\x02"},
{"mime/multipart", "\x02\x01G$\x03E5\f\x01\x06\x02\x15\x02\x06\x10\x02\x01\x15"},
{"mime/quotedprintable", "\x02\x01nz"},
{"net", "\x04\ta+\x1d\a\x04\x05\x05\a\x01\x04\x14\x01%\x06\r\t\x05\x01\x01\v\x06\a"},
{"net/http", "\x02\x01\x04\x04\x02=\b\x14\x01\a\x03E5\x01\x03\b\x01\x02\x02\x02\x01\x02\x06\x02\x01\x01\n\x01\x01\x05\x01\x02\x05\t\x01\x01\x01\x02\x01\f\x02\x02\x02\b\x01\x01\x01"},
{"net/http/cgi", "\x02P\x1c\x03z\x04\b\n\x01\x13\x01\x01\x01\x04\x01\x05\x02\t\x02\x01\x0f\x0e"},
{"net/http/cookiejar", "\x04j\x03\x90\x01\x01\b\f\x17\x03\x02\r\x04"},
{"net/http/fcgi", "\x02\x01\nZ\a\x03z\x16\x01\x01\x14\x19\x02\r"},
{"net/http/httptest", "\x02\x01\nE\x02\x1c\x01z\x04\x12\x01\n\t\x02\x18\x01\x02\r\x0e"},
{"net/http/httptrace", "\rEo@\x14\n "},
{"net/http/httputil", "\x02\x01\na\x03z\x04\x0f\x03\x01\x05\x02\x01\v\x01\x1a\x02\r\x0e"},
{"net/http/internal", "\x02\x01k\x03z"},
{"net/http/internal/ascii", "\xb0\x02\x11"},
{"net/http/internal/httpcommon", "\ra\x03\x96\x01\x0e\x01\x18\x01\x01\x02\x1b\x02"},
{"net/http/internal/testcert", "\xb0\x02"},
{"net/http/pprof", "\x02\x01\nd\x19,\x11$\x04\x13\x14\x01\r\x06\x02\x01\x02\x01\x0f"},
{"net/internal/cgotest", "\xd7\x01n"},
{"net/internal/socktest", "q\xc1\x01\x02"},
{"net/mail", "\x02l\x03z\x04\x0f\x03\x14\x1b\x02\r\x04"},
{"net/netip", "\x04j+\x01#;\x025\x15"},
{"net/rpc", "\x02g\x05\x03\x10\n`\x04\x12\x01\x1d\x0e\x03\x02"},
{"net/rpc/jsonrpc", "k\x03\x03z\x16\x11 "},
{"net/smtp", "\x19.\v\x14\b\x03z\x16\x14\x1b"},
{"net/textproto", "\x02\x01k\x03z\r\t.\x01\x02\x13"},
{"net/url", "n\x03\x86\x01%\x11\x02\x01\x15"},
{"os", "n+\x19\v\t\r\x03\x01\x04\x10\x018\t\x05\x01\x01\v\x06"},
{"os/exec", "\x03\naH \x01\x14\x01+\x06\a\v\x01\x04\v"},
{"os/exec/internal/fdtest", "\xb4\x02"},
{"os/signal", "\r\x8a\x02\x16\x05\x02"},
{"os/user", "qfM\v\x01\x02\x02\x11"},
{"path", "n+\xaa\x01"},
{"path/filepath", "n+\x19:+\r\t\x03\x04\x0f"},
{"plugin", "n\xc4\x01\x13"},
{"reflect", "n'\x04\x1c\b\f\x05\x02\x18\x06\n,\v\x03\x0f\x02\x02"},
{"reflect/internal/example1", ""},
{"reflect/internal/example2", ""},
{"regexp", "\x03\xe8\x018\n\x02\x01\x02\x0f\x02"},
{"regexp/syntax", "\xad\x02\x01\x01\x01\x11\x02"},
{"runtime", "\x95\x01\x04\x01\x02\f\x06\a\x02\x01\x01\x0f\x04\x01\x01\x01\x01\x03\x0fc"},
{"runtime/cgo", "\xd0\x01b\x01\x12"},
{"runtime/coverage", "\xa0\x01K"},
{"runtime/debug", "qUQ\r\t\x02\x01\x0f\x06"},
{"runtime/internal/wasitest", ""},
{"runtime/metrics", "\xb7\x01A,!"},
{"runtime/pprof", "\x02\x01\x01\x03\x06Z\a\x03$3#\r\x1f\r\t\x01\x01\x01\x02\x02\b\x03\x06"},
{"runtime/race", ""},
{"runtime/trace", "\rdz9\x0e\x01\x12"},
{"slices", "\x04\xea\x01\fK"},
{"sort", "\xca\x0103"},
{"strconv", "n+:%\x02I"},
{"strings", "n'\x04:\x18\x03\f8\x0f\x02\x02"},
{"structs", ""},
{"sync", "\xc9\x01\vP\x0f\x12"},
{"sync/atomic", "\xc5\x02"},
{"syscall", "n'\x01\x03\x01\x1b\b\x03\x03\x06[\x0e\x01\x12"},
{"testing", "\x03\na\x02\x01X\x0f\x13\r\x04\x1b\x06\x02\x05\x03\x05\x01\x02\x01\x02\x01\f\x02\x02\x02"},
{"testing/fstest", "n\x03z\x01\v%\x11\x03\b\a"},
{"testing/internal/testdeps", "\x02\v\xa7\x01'\x10,\x03\x05\x03\b\x06\x02\r"},
{"testing/iotest", "\x03k\x03z\x04"},
{"testing/quick", "p\x01\x87\x01\x04#\x11\x0f"},
{"testing/slogtest", "\ra\x03\x80\x01.\x05\x11\n"},
{"text/scanner", "\x03nz,*\x02"},
{"text/tabwriter", "qzX"},
{"text/template", "n\x03B8\x01\v\x1f\x01\x05\x01\x02\x05\f\x02\f\x03\x02"},
{"text/template/parse", "\x03n\xb3\x01\v\x01\x11\x02"},
{"time", "n+\x1d\x1d'*\x0e\x02\x11"},
{"time/tzdata", "n\xc6\x01\x11"},
{"unicode", ""},
{"unicode/utf16", ""},
{"unicode/utf8", ""},
{"unique", "\x95\x01>\x01P\x0e\x13\x12"},
{"unsafe", ""},
{"vendor/golang.org/x/crypto/chacha20", "\x10W\a\x8c\x01*&"},
{"vendor/golang.org/x/crypto/chacha20poly1305", "\x10W\a\xd8\x01\x04\x01"},
{"vendor/golang.org/x/crypto/cryptobyte", "d\n\x03\x88\x01& \n"},
{"vendor/golang.org/x/crypto/cryptobyte/asn1", ""},
{"vendor/golang.org/x/crypto/internal/alias", "\xc5\x02"},
{"vendor/golang.org/x/crypto/internal/poly1305", "Q\x16\x93\x01"},
{"vendor/golang.org/x/net/dns/dnsmessage", "n"},
{"vendor/golang.org/x/net/http/httpguts", "\x81\x02\x14\x1b\x13\r"},
{"vendor/golang.org/x/net/http/httpproxy", "n\x03\x90\x01\x15\x01\x19\x13\r"},
{"vendor/golang.org/x/net/http2/hpack", "\x03k\x03zG"},
{"vendor/golang.org/x/net/idna", "q\x87\x018\x13\x10\x02\x01"},
{"vendor/golang.org/x/net/nettest", "\x03d\a\x03z\x11\x05\x16\x01\f\v\x01\x02\x02\x01\n"},
{"vendor/golang.org/x/sys/cpu", "\x97\x02\r\v\x01\x15"},
{"vendor/golang.org/x/text/secure/bidirule", "n\xd5\x01\x11\x01"},
{"vendor/golang.org/x/text/transform", "\x03k}X"},
{"vendor/golang.org/x/text/unicode/bidi", "\x03\bf~?\x15"},
{"vendor/golang.org/x/text/unicode/norm", "g\nzG\x11\x11"},
{"weak", "\x95\x01\x8f\x01!"},
}

89
vendor/golang.org/x/tools/internal/stdlib/import.go generated vendored Normal file
View File

@ -0,0 +1,89 @@
// Copyright 2025 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 stdlib
// This file provides the API for the import graph of the standard library.
//
// Be aware that the compiler-generated code for every package
// implicitly depends on package "runtime" and a handful of others
// (see runtimePkgs in GOROOT/src/cmd/internal/objabi/pkgspecial.go).
import (
"encoding/binary"
"iter"
"slices"
"strings"
)
// Imports returns the sequence of packages directly imported by the
// named standard packages, in name order.
// The imports of an unknown package are the empty set.
//
// The graph is built into the application and may differ from the
// graph in the Go source tree being analyzed by the application.
func Imports(pkgs ...string) iter.Seq[string] {
return func(yield func(string) bool) {
for _, pkg := range pkgs {
if i, ok := find(pkg); ok {
var depIndex uint64
for data := []byte(deps[i].deps); len(data) > 0; {
delta, n := binary.Uvarint(data)
depIndex += delta
if !yield(deps[depIndex].name) {
return
}
data = data[n:]
}
}
}
}
}
// Dependencies returns the set of all dependencies of the named
// standard packages, including the initial package,
// in a deterministic topological order.
// The dependencies of an unknown package are the empty set.
//
// The graph is built into the application and may differ from the
// graph in the Go source tree being analyzed by the application.
func Dependencies(pkgs ...string) iter.Seq[string] {
return func(yield func(string) bool) {
for _, pkg := range pkgs {
if i, ok := find(pkg); ok {
var seen [1 + len(deps)/8]byte // bit set of seen packages
var visit func(i int) bool
visit = func(i int) bool {
bit := byte(1) << (i % 8)
if seen[i/8]&bit == 0 {
seen[i/8] |= bit
var depIndex uint64
for data := []byte(deps[i].deps); len(data) > 0; {
delta, n := binary.Uvarint(data)
depIndex += delta
if !visit(int(depIndex)) {
return false
}
data = data[n:]
}
if !yield(deps[i].name) {
return false
}
}
return true
}
if !visit(i) {
return
}
}
}
}
}
// find returns the index of pkg in the deps table.
func find(pkg string) (int, bool) {
return slices.BinarySearchFunc(deps[:], pkg, func(p pkginfo, n string) int {
return strings.Compare(p.name, n)
})
}

View File

@ -1,4 +1,4 @@
// Copyright 2024 The Go Authors. All rights reserved. // Copyright 2025 The Go Authors. All rights reserved.
// 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.
@ -2151,6 +2151,8 @@ var PackageSymbols = map[string][]Symbol{
{"(Type).String", Method, 0}, {"(Type).String", Method, 0},
{"(Version).GoString", Method, 0}, {"(Version).GoString", Method, 0},
{"(Version).String", Method, 0}, {"(Version).String", Method, 0},
{"(VersionIndex).Index", Method, 24},
{"(VersionIndex).IsHidden", Method, 24},
{"ARM_MAGIC_TRAMP_NUMBER", Const, 0}, {"ARM_MAGIC_TRAMP_NUMBER", Const, 0},
{"COMPRESS_HIOS", Const, 6}, {"COMPRESS_HIOS", Const, 6},
{"COMPRESS_HIPROC", Const, 6}, {"COMPRESS_HIPROC", Const, 6},
@ -3834,6 +3836,7 @@ var PackageSymbols = map[string][]Symbol{
{"SymType", Type, 0}, {"SymType", Type, 0},
{"SymVis", Type, 0}, {"SymVis", Type, 0},
{"Symbol", Type, 0}, {"Symbol", Type, 0},
{"Symbol.HasVersion", Field, 24},
{"Symbol.Info", Field, 0}, {"Symbol.Info", Field, 0},
{"Symbol.Library", Field, 13}, {"Symbol.Library", Field, 13},
{"Symbol.Name", Field, 0}, {"Symbol.Name", Field, 0},
@ -3843,18 +3846,12 @@ var PackageSymbols = map[string][]Symbol{
{"Symbol.Value", Field, 0}, {"Symbol.Value", Field, 0},
{"Symbol.Version", Field, 13}, {"Symbol.Version", Field, 13},
{"Symbol.VersionIndex", Field, 24}, {"Symbol.VersionIndex", Field, 24},
{"Symbol.VersionScope", Field, 24},
{"SymbolVersionScope", Type, 24},
{"Type", Type, 0}, {"Type", Type, 0},
{"VER_FLG_BASE", Const, 24}, {"VER_FLG_BASE", Const, 24},
{"VER_FLG_INFO", Const, 24}, {"VER_FLG_INFO", Const, 24},
{"VER_FLG_WEAK", Const, 24}, {"VER_FLG_WEAK", Const, 24},
{"Version", Type, 0}, {"Version", Type, 0},
{"VersionScopeGlobal", Const, 24}, {"VersionIndex", Type, 24},
{"VersionScopeHidden", Const, 24},
{"VersionScopeLocal", Const, 24},
{"VersionScopeNone", Const, 24},
{"VersionScopeSpecific", Const, 24},
}, },
"debug/gosym": { "debug/gosym": {
{"(*DecodingError).Error", Method, 0}, {"(*DecodingError).Error", Method, 0},
@ -7122,6 +7119,7 @@ var PackageSymbols = map[string][]Symbol{
{"FormatFileInfo", Func, 21}, {"FormatFileInfo", Func, 21},
{"Glob", Func, 16}, {"Glob", Func, 16},
{"GlobFS", Type, 16}, {"GlobFS", Type, 16},
{"Lstat", Func, 25},
{"ModeAppend", Const, 16}, {"ModeAppend", Const, 16},
{"ModeCharDevice", Const, 16}, {"ModeCharDevice", Const, 16},
{"ModeDevice", Const, 16}, {"ModeDevice", Const, 16},
@ -7146,6 +7144,8 @@ var PackageSymbols = map[string][]Symbol{
{"ReadDirFile", Type, 16}, {"ReadDirFile", Type, 16},
{"ReadFile", Func, 16}, {"ReadFile", Func, 16},
{"ReadFileFS", Type, 16}, {"ReadFileFS", Type, 16},
{"ReadLink", Func, 25},
{"ReadLinkFS", Type, 25},
{"SkipAll", Var, 20}, {"SkipAll", Var, 20},
{"SkipDir", Var, 16}, {"SkipDir", Var, 16},
{"Stat", Func, 16}, {"Stat", Func, 16},
@ -9149,6 +9149,8 @@ var PackageSymbols = map[string][]Symbol{
{"(*ProcessState).SysUsage", Method, 0}, {"(*ProcessState).SysUsage", Method, 0},
{"(*ProcessState).SystemTime", Method, 0}, {"(*ProcessState).SystemTime", Method, 0},
{"(*ProcessState).UserTime", Method, 0}, {"(*ProcessState).UserTime", Method, 0},
{"(*Root).Chmod", Method, 25},
{"(*Root).Chown", Method, 25},
{"(*Root).Close", Method, 24}, {"(*Root).Close", Method, 24},
{"(*Root).Create", Method, 24}, {"(*Root).Create", Method, 24},
{"(*Root).FS", Method, 24}, {"(*Root).FS", Method, 24},
@ -16757,9 +16759,11 @@ var PackageSymbols = map[string][]Symbol{
}, },
"testing/fstest": { "testing/fstest": {
{"(MapFS).Glob", Method, 16}, {"(MapFS).Glob", Method, 16},
{"(MapFS).Lstat", Method, 25},
{"(MapFS).Open", Method, 16}, {"(MapFS).Open", Method, 16},
{"(MapFS).ReadDir", Method, 16}, {"(MapFS).ReadDir", Method, 16},
{"(MapFS).ReadFile", Method, 16}, {"(MapFS).ReadFile", Method, 16},
{"(MapFS).ReadLink", Method, 25},
{"(MapFS).Stat", Method, 16}, {"(MapFS).Stat", Method, 16},
{"(MapFS).Sub", Method, 16}, {"(MapFS).Sub", Method, 16},
{"MapFS", Type, 16}, {"MapFS", Type, 16},

View File

@ -6,7 +6,7 @@
// Package stdlib provides a table of all exported symbols in the // Package stdlib provides a table of all exported symbols in the
// standard library, along with the version at which they first // standard library, along with the version at which they first
// appeared. // appeared. It also provides the import graph of std packages.
package stdlib package stdlib
import ( import (

View File

@ -109,8 +109,13 @@ func CoreType(T types.Type) types.Type {
// //
// NormalTerms makes no guarantees about the order of terms, except that it // NormalTerms makes no guarantees about the order of terms, except that it
// is deterministic. // is deterministic.
func NormalTerms(typ types.Type) ([]*types.Term, error) { func NormalTerms(T types.Type) ([]*types.Term, error) {
switch typ := typ.Underlying().(type) { // typeSetOf(T) == typeSetOf(Unalias(T))
typ := types.Unalias(T)
if named, ok := typ.(*types.Named); ok {
typ = named.Underlying()
}
switch typ := typ.(type) {
case *types.TypeParam: case *types.TypeParam:
return StructuralTerms(typ) return StructuralTerms(typ)
case *types.Union: case *types.Union:
@ -118,7 +123,7 @@ func NormalTerms(typ types.Type) ([]*types.Term, error) {
case *types.Interface: case *types.Interface:
return InterfaceTermSet(typ) return InterfaceTermSet(typ)
default: default:
return []*types.Term{types.NewTerm(false, typ)}, nil return []*types.Term{types.NewTerm(false, T)}, nil
} }
} }

View File

@ -120,7 +120,7 @@ type termSet struct {
terms termlist terms termlist
} }
func indentf(depth int, format string, args ...interface{}) { func indentf(depth int, format string, args ...any) {
fmt.Fprintf(os.Stderr, strings.Repeat(".", depth)+format+"\n", args...) fmt.Fprintf(os.Stderr, strings.Repeat(".", depth)+format+"\n", args...)
} }

View File

@ -966,7 +966,7 @@ const (
// var _ = string(x) // var _ = string(x)
InvalidConversion InvalidConversion
// InvalidUntypedConversion occurs when an there is no valid implicit // InvalidUntypedConversion occurs when there is no valid implicit
// conversion from an untyped value satisfying the type constraints of the // conversion from an untyped value satisfying the type constraints of the
// context in which it is used. // context in which it is used.
// //

View File

@ -12,7 +12,8 @@ import (
// type of recv, which may be of the form N or *N, or aliases thereof. // type of recv, which may be of the form N or *N, or aliases thereof.
// It also reports whether a Pointer was present. // It also reports whether a Pointer was present.
// //
// The named result may be nil in ill-typed code. // The named result may be nil if recv is from a method on an
// anonymous interface or struct types or in ill-typed code.
func ReceiverNamed(recv *types.Var) (isPtr bool, named *types.Named) { func ReceiverNamed(recv *types.Var) (isPtr bool, named *types.Named) {
t := recv.Type() t := recv.Type()
if ptr, ok := types.Unalias(t).(*types.Pointer); ok { if ptr, ok := types.Unalias(t).(*types.Pointer); ok {

View File

@ -32,12 +32,14 @@ func SetUsesCgo(conf *types.Config) bool {
return true return true
} }
// ReadGo116ErrorData extracts additional information from types.Error values // ErrorCodeStartEnd extracts additional information from types.Error values
// generated by Go version 1.16 and later: the error code, start position, and // generated by Go version 1.16 and later: the error code, start position, and
// end position. If all positions are valid, start <= err.Pos <= end. // end position. If all positions are valid, start <= err.Pos <= end.
// //
// If the data could not be read, the final result parameter will be false. // If the data could not be read, the final result parameter will be false.
func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) { //
// TODO(adonovan): eliminate start/end when proposal #71803 is accepted.
func ErrorCodeStartEnd(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) {
var data [3]int var data [3]int
// By coincidence all of these fields are ints, which simplifies things. // By coincidence all of these fields are ints, which simplifies things.
v := reflect.ValueOf(err) v := reflect.ValueOf(err)
@ -120,3 +122,8 @@ func Origin(t NamedOrAlias) NamedOrAlias {
} }
return t return t
} }
// IsPackageLevel reports whether obj is a package-level symbol.
func IsPackageLevel(obj types.Object) bool {
return obj.Pkg() != nil && obj.Parent() == obj.Pkg().Scope()
}

View File

@ -0,0 +1,40 @@
// Copyright 2024 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 typesinternal
// TODO(adonovan): when CL 645115 lands, define the go1.25 version of
// this API that actually does something.
import "go/types"
type VarKind uint8
const (
_ VarKind = iota // (not meaningful)
PackageVar // a package-level variable
LocalVar // a local variable
RecvVar // a method receiver variable
ParamVar // a function parameter variable
ResultVar // a function result variable
FieldVar // a struct field
)
func (kind VarKind) String() string {
return [...]string{
0: "VarKind(0)",
PackageVar: "PackageVar",
LocalVar: "LocalVar",
RecvVar: "RecvVar",
ParamVar: "ParamVar",
ResultVar: "ResultVar",
FieldVar: "FieldVar",
}[kind]
}
// GetVarKind returns an invalid VarKind.
func GetVarKind(v *types.Var) VarKind { return 0 }
// SetVarKind has no effect.
func SetVarKind(v *types.Var, kind VarKind) {}

29
vendor/modules.txt vendored
View File

@ -67,21 +67,21 @@ github.com/russross/blackfriday/v2
# go.etcd.io/bbolt v1.3.11 # go.etcd.io/bbolt v1.3.11
## explicit; go 1.22 ## explicit; go 1.22
go.etcd.io/bbolt go.etcd.io/bbolt
# golang.org/x/crypto v0.32.0 # golang.org/x/crypto v0.36.0
## explicit; go 1.20 ## explicit; go 1.23.0
golang.org/x/crypto/acme golang.org/x/crypto/acme
golang.org/x/crypto/bcrypt golang.org/x/crypto/bcrypt
golang.org/x/crypto/blake2b golang.org/x/crypto/blake2b
golang.org/x/crypto/blowfish golang.org/x/crypto/blowfish
golang.org/x/crypto/pbkdf2 golang.org/x/crypto/pbkdf2
# golang.org/x/mod v0.22.0 # golang.org/x/mod v0.24.0
## explicit; go 1.22.0 ## explicit; go 1.23.0
golang.org/x/mod/internal/lazyregexp golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/modfile golang.org/x/mod/modfile
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.34.0 # golang.org/x/net v0.38.0
## explicit; go 1.18 ## explicit; go 1.23.0
golang.org/x/net/dns/dnsmessage golang.org/x/net/dns/dnsmessage
golang.org/x/net/html golang.org/x/net/html
golang.org/x/net/html/atom golang.org/x/net/html/atom
@ -89,19 +89,20 @@ golang.org/x/net/http/httpguts
golang.org/x/net/http2 golang.org/x/net/http2
golang.org/x/net/http2/hpack golang.org/x/net/http2/hpack
golang.org/x/net/idna golang.org/x/net/idna
golang.org/x/net/internal/httpcommon
golang.org/x/net/internal/socks golang.org/x/net/internal/socks
golang.org/x/net/proxy golang.org/x/net/proxy
golang.org/x/net/websocket golang.org/x/net/websocket
# golang.org/x/sync v0.10.0 # golang.org/x/sync v0.12.0
## explicit; go 1.18 ## explicit; go 1.23.0
golang.org/x/sync/errgroup golang.org/x/sync/errgroup
# golang.org/x/sys v0.29.0 # golang.org/x/sys v0.31.0
## explicit; go 1.18 ## explicit; go 1.23.0
golang.org/x/sys/cpu golang.org/x/sys/cpu
golang.org/x/sys/unix golang.org/x/sys/unix
golang.org/x/sys/windows golang.org/x/sys/windows
# golang.org/x/text v0.21.0 # golang.org/x/text v0.23.0
## explicit; go 1.18 ## explicit; go 1.23.0
golang.org/x/text/cases golang.org/x/text/cases
golang.org/x/text/encoding golang.org/x/text/encoding
golang.org/x/text/encoding/charmap golang.org/x/text/encoding/charmap
@ -126,8 +127,8 @@ golang.org/x/text/transform
golang.org/x/text/unicode/bidi golang.org/x/text/unicode/bidi
golang.org/x/text/unicode/norm golang.org/x/text/unicode/norm
golang.org/x/text/width golang.org/x/text/width
# golang.org/x/tools v0.29.0 # golang.org/x/tools v0.31.0
## explicit; go 1.22.0 ## explicit; go 1.23.0
golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/gcexportdata
golang.org/x/tools/go/packages golang.org/x/tools/go/packages
golang.org/x/tools/go/types/objectpath golang.org/x/tools/go/types/objectpath