mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
vendor: update x/tools to 3adf0e9, and other repos
Notably, the x/tools update includes CL 702835. Also, pacify copyright_test report of missing copyright header in generated h2_bundle. Updates golang/go#75432 Change-Id: I428278e50dbcef5dcaa661004da0da9ab8f2c924 Reviewed-on: https://go-review.googlesource.com/c/go/+/702955 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
This commit is contained in:
parent
911455fe18
commit
cc8a6780ac
35 changed files with 1376 additions and 1112 deletions
|
|
@ -6,16 +6,16 @@ require (
|
||||||
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5
|
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5
|
||||||
golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58
|
golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58
|
||||||
golang.org/x/build v0.0.0-20250806225920-b7c66c047964
|
golang.org/x/build v0.0.0-20250806225920-b7c66c047964
|
||||||
golang.org/x/mod v0.27.0
|
golang.org/x/mod v0.28.0
|
||||||
golang.org/x/sync v0.16.0
|
golang.org/x/sync v0.17.0
|
||||||
golang.org/x/sys v0.35.0
|
golang.org/x/sys v0.36.0
|
||||||
golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488
|
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053
|
||||||
golang.org/x/term v0.34.0
|
golang.org/x/term v0.34.0
|
||||||
golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08
|
golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b // indirect
|
github.com/ianlancetaylor/demangle v0.0.0-20250417193237-f615e6bd150b // indirect
|
||||||
golang.org/x/text v0.28.0 // indirect
|
golang.org/x/text v0.29.0 // indirect
|
||||||
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef // indirect
|
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef // indirect
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -10,19 +10,19 @@ golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58 h1:uxPa6+/WsUfzikIAPMqpT
|
||||||
golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
golang.org/x/arch v0.20.1-0.20250808194827-46ba08e3ae58/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
|
||||||
golang.org/x/build v0.0.0-20250806225920-b7c66c047964 h1:yRs1K51GKq7hsIO+YHJ8LsslrvwFceNPIv0tYjpcBd0=
|
golang.org/x/build v0.0.0-20250806225920-b7c66c047964 h1:yRs1K51GKq7hsIO+YHJ8LsslrvwFceNPIv0tYjpcBd0=
|
||||||
golang.org/x/build v0.0.0-20250806225920-b7c66c047964/go.mod h1:i9Vx7+aOQUpYJRxSO+OpRStVBCVL/9ccI51xblWm5WY=
|
golang.org/x/build v0.0.0-20250806225920-b7c66c047964/go.mod h1:i9Vx7+aOQUpYJRxSO+OpRStVBCVL/9ccI51xblWm5WY=
|
||||||
golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ=
|
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
|
||||||
golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc=
|
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
|
||||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488 h1:3doPGa+Gg4snce233aCWnbZVFsyFMo/dR40KK/6skyE=
|
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 h1:dHQOQddU4YHS5gY33/6klKjq7Gp3WwMyOXGNp5nzRj8=
|
||||||
golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488/go.mod h1:fGb/2+tgXXjhjHsTNdVEEMZNWA0quBnfrO+AfoDSAKw=
|
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053/go.mod h1:+nZKN+XVh4LCiA9DV3ywrzN4gumyCnKjau3NGb9SGoE=
|
||||||
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
|
||||||
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
|
||||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||||
golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08 h1:KS/PXsrK6W9NdlNu8iuCiNb7KM8UFwsh8g1BUjJ9rww=
|
golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d h1:ykSs3aFXygx903AtF0IG27E/xLaCW5t85BAdCALyp8s=
|
||||||
golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08/go.mod h1:n+8pplxVZfXnmHBxWsfPnQRJ5vWroQDk+U2MFpjwtFY=
|
golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
|
||||||
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef h1:mqLYrXCXYEZOop9/Dbo6RPX11539nwiCNBb1icVPmw8=
|
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef h1:mqLYrXCXYEZOop9/Dbo6RPX11539nwiCNBb1icVPmw8=
|
||||||
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef/go.mod h1:8xcPgWmwlZONN1D9bjxtHEjrUtSEa3fakVF8iaewYKQ=
|
rsc.io/markdown v0.0.0-20240306144322-0bf8f97ee8ef/go.mod h1:8xcPgWmwlZONN1D9bjxtHEjrUtSEa3fakVF8iaewYKQ=
|
||||||
|
|
|
||||||
21
src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go
generated
vendored
21
src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go
generated
vendored
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2015 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.5
|
|
||||||
|
|
||||||
package plan9
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
func fixwd() {
|
|
||||||
syscall.Fixwd()
|
|
||||||
}
|
|
||||||
|
|
||||||
func Getwd() (wd string, err error) {
|
|
||||||
return syscall.Getwd()
|
|
||||||
}
|
|
||||||
|
|
||||||
func Chdir(path string) error {
|
|
||||||
return syscall.Chdir(path)
|
|
||||||
}
|
|
||||||
14
src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go
generated
vendored
14
src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go
generated
vendored
|
|
@ -2,22 +2,18 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !go1.5
|
|
||||||
|
|
||||||
package plan9
|
package plan9
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
func fixwd() {
|
func fixwd() {
|
||||||
|
syscall.Fixwd()
|
||||||
}
|
}
|
||||||
|
|
||||||
func Getwd() (wd string, err error) {
|
func Getwd() (wd string, err error) {
|
||||||
fd, err := open(".", O_RDONLY)
|
return syscall.Getwd()
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
defer Close(fd)
|
|
||||||
return Fd2path(fd)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Chdir(path string) error {
|
func Chdir(path string) error {
|
||||||
return chdir(path)
|
return syscall.Chdir(path)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
src/cmd/vendor/golang.org/x/sys/unix/affinity_linux.go
generated
vendored
4
src/cmd/vendor/golang.org/x/sys/unix/affinity_linux.go
generated
vendored
|
|
@ -38,9 +38,7 @@ func SchedSetaffinity(pid int, set *CPUSet) error {
|
||||||
|
|
||||||
// Zero clears the set s, so that it contains no CPUs.
|
// Zero clears the set s, so that it contains no CPUs.
|
||||||
func (s *CPUSet) Zero() {
|
func (s *CPUSet) Zero() {
|
||||||
for i := range s {
|
clear(s[:])
|
||||||
s[i] = 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func cpuBitsIndex(cpu int) int {
|
func cpuBitsIndex(cpu int) int {
|
||||||
|
|
|
||||||
2
src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
2
src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
|
|
@ -629,7 +629,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys Kill(pid int, signum syscall.Signal) (err error)
|
//sys Kill(pid int, signum syscall.Signal) (err error)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error)
|
//sys Lchown(path string, uid int, gid int) (err error)
|
||||||
//sys Link(path string, link string) (err error)
|
//sys Link(path string, link string) (err error)
|
||||||
//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_llisten
|
//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_listen
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Madvise(b []byte, advice int) (err error)
|
//sys Madvise(b []byte, advice int) (err error)
|
||||||
//sys Mkdir(path string, mode uint32) (err error)
|
//sys Mkdir(path string, mode uint32) (err error)
|
||||||
|
|
|
||||||
8
src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
generated
vendored
8
src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
generated
vendored
|
|
@ -72,7 +72,7 @@ import (
|
||||||
//go:cgo_import_dynamic libc_kill kill "libc.so"
|
//go:cgo_import_dynamic libc_kill kill "libc.so"
|
||||||
//go:cgo_import_dynamic libc_lchown lchown "libc.so"
|
//go:cgo_import_dynamic libc_lchown lchown "libc.so"
|
||||||
//go:cgo_import_dynamic libc_link link "libc.so"
|
//go:cgo_import_dynamic libc_link link "libc.so"
|
||||||
//go:cgo_import_dynamic libc___xnet_llisten __xnet_llisten "libsocket.so"
|
//go:cgo_import_dynamic libc___xnet_listen __xnet_listen "libsocket.so"
|
||||||
//go:cgo_import_dynamic libc_lstat lstat "libc.so"
|
//go:cgo_import_dynamic libc_lstat lstat "libc.so"
|
||||||
//go:cgo_import_dynamic libc_madvise madvise "libc.so"
|
//go:cgo_import_dynamic libc_madvise madvise "libc.so"
|
||||||
//go:cgo_import_dynamic libc_mkdir mkdir "libc.so"
|
//go:cgo_import_dynamic libc_mkdir mkdir "libc.so"
|
||||||
|
|
@ -221,7 +221,7 @@ import (
|
||||||
//go:linkname procKill libc_kill
|
//go:linkname procKill libc_kill
|
||||||
//go:linkname procLchown libc_lchown
|
//go:linkname procLchown libc_lchown
|
||||||
//go:linkname procLink libc_link
|
//go:linkname procLink libc_link
|
||||||
//go:linkname proc__xnet_llisten libc___xnet_llisten
|
//go:linkname proc__xnet_listen libc___xnet_listen
|
||||||
//go:linkname procLstat libc_lstat
|
//go:linkname procLstat libc_lstat
|
||||||
//go:linkname procMadvise libc_madvise
|
//go:linkname procMadvise libc_madvise
|
||||||
//go:linkname procMkdir libc_mkdir
|
//go:linkname procMkdir libc_mkdir
|
||||||
|
|
@ -371,7 +371,7 @@ var (
|
||||||
procKill,
|
procKill,
|
||||||
procLchown,
|
procLchown,
|
||||||
procLink,
|
procLink,
|
||||||
proc__xnet_llisten,
|
proc__xnet_listen,
|
||||||
procLstat,
|
procLstat,
|
||||||
procMadvise,
|
procMadvise,
|
||||||
procMkdir,
|
procMkdir,
|
||||||
|
|
@ -1178,7 +1178,7 @@ func Link(path string, link string) (err error) {
|
||||||
// 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 Listen(s int, backlog int) (err error) {
|
func Listen(s int, backlog int) (err error) {
|
||||||
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0)
|
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_listen)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
41
src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
41
src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
|
|
@ -632,6 +632,8 @@ const (
|
||||||
IFA_FLAGS = 0x8
|
IFA_FLAGS = 0x8
|
||||||
IFA_RT_PRIORITY = 0x9
|
IFA_RT_PRIORITY = 0x9
|
||||||
IFA_TARGET_NETNSID = 0xa
|
IFA_TARGET_NETNSID = 0xa
|
||||||
|
IFAL_LABEL = 0x2
|
||||||
|
IFAL_ADDRESS = 0x1
|
||||||
RT_SCOPE_UNIVERSE = 0x0
|
RT_SCOPE_UNIVERSE = 0x0
|
||||||
RT_SCOPE_SITE = 0xc8
|
RT_SCOPE_SITE = 0xc8
|
||||||
RT_SCOPE_LINK = 0xfd
|
RT_SCOPE_LINK = 0xfd
|
||||||
|
|
@ -689,6 +691,7 @@ const (
|
||||||
SizeofRtAttr = 0x4
|
SizeofRtAttr = 0x4
|
||||||
SizeofIfInfomsg = 0x10
|
SizeofIfInfomsg = 0x10
|
||||||
SizeofIfAddrmsg = 0x8
|
SizeofIfAddrmsg = 0x8
|
||||||
|
SizeofIfAddrlblmsg = 0xc
|
||||||
SizeofIfaCacheinfo = 0x10
|
SizeofIfaCacheinfo = 0x10
|
||||||
SizeofRtMsg = 0xc
|
SizeofRtMsg = 0xc
|
||||||
SizeofRtNexthop = 0x8
|
SizeofRtNexthop = 0x8
|
||||||
|
|
@ -740,6 +743,15 @@ type IfAddrmsg struct {
|
||||||
Index uint32
|
Index uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type IfAddrlblmsg struct {
|
||||||
|
Family uint8
|
||||||
|
_ uint8
|
||||||
|
Prefixlen uint8
|
||||||
|
Flags uint8
|
||||||
|
Index uint32
|
||||||
|
Seq uint32
|
||||||
|
}
|
||||||
|
|
||||||
type IfaCacheinfo struct {
|
type IfaCacheinfo struct {
|
||||||
Prefered uint32
|
Prefered uint32
|
||||||
Valid uint32
|
Valid uint32
|
||||||
|
|
@ -3052,6 +3064,23 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
TCA_UNSPEC = 0x0
|
||||||
|
TCA_KIND = 0x1
|
||||||
|
TCA_OPTIONS = 0x2
|
||||||
|
TCA_STATS = 0x3
|
||||||
|
TCA_XSTATS = 0x4
|
||||||
|
TCA_RATE = 0x5
|
||||||
|
TCA_FCNT = 0x6
|
||||||
|
TCA_STATS2 = 0x7
|
||||||
|
TCA_STAB = 0x8
|
||||||
|
TCA_PAD = 0x9
|
||||||
|
TCA_DUMP_INVISIBLE = 0xa
|
||||||
|
TCA_CHAIN = 0xb
|
||||||
|
TCA_HW_OFFLOAD = 0xc
|
||||||
|
TCA_INGRESS_BLOCK = 0xd
|
||||||
|
TCA_EGRESS_BLOCK = 0xe
|
||||||
|
TCA_DUMP_FLAGS = 0xf
|
||||||
|
TCA_EXT_WARN_MSG = 0x10
|
||||||
RTNLGRP_NONE = 0x0
|
RTNLGRP_NONE = 0x0
|
||||||
RTNLGRP_LINK = 0x1
|
RTNLGRP_LINK = 0x1
|
||||||
RTNLGRP_NOTIFY = 0x2
|
RTNLGRP_NOTIFY = 0x2
|
||||||
|
|
@ -3086,6 +3115,18 @@ const (
|
||||||
RTNLGRP_IPV6_MROUTE_R = 0x1f
|
RTNLGRP_IPV6_MROUTE_R = 0x1f
|
||||||
RTNLGRP_NEXTHOP = 0x20
|
RTNLGRP_NEXTHOP = 0x20
|
||||||
RTNLGRP_BRVLAN = 0x21
|
RTNLGRP_BRVLAN = 0x21
|
||||||
|
RTNLGRP_MCTP_IFADDR = 0x22
|
||||||
|
RTNLGRP_TUNNEL = 0x23
|
||||||
|
RTNLGRP_STATS = 0x24
|
||||||
|
RTNLGRP_IPV4_MCADDR = 0x25
|
||||||
|
RTNLGRP_IPV6_MCADDR = 0x26
|
||||||
|
RTNLGRP_IPV6_ACADDR = 0x27
|
||||||
|
TCA_ROOT_UNSPEC = 0x0
|
||||||
|
TCA_ROOT_TAB = 0x1
|
||||||
|
TCA_ROOT_FLAGS = 0x2
|
||||||
|
TCA_ROOT_COUNT = 0x3
|
||||||
|
TCA_ROOT_TIME_DELTA = 0x4
|
||||||
|
TCA_ROOT_EXT_WARN_MSG = 0x5
|
||||||
)
|
)
|
||||||
|
|
||||||
type CapUserHeader struct {
|
type CapUserHeader struct {
|
||||||
|
|
|
||||||
6
src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
6
src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
|
|
@ -1976,6 +1976,12 @@ const (
|
||||||
SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
|
SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// FILE_ZERO_DATA_INFORMATION from winioctl.h
|
||||||
|
type FileZeroDataInformation struct {
|
||||||
|
FileOffset int64
|
||||||
|
BeyondFinalZero int64
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ComputerNameNetBIOS = 0
|
ComputerNameNetBIOS = 0
|
||||||
ComputerNameDnsHostname = 1
|
ComputerNameDnsHostname = 1
|
||||||
|
|
|
||||||
966
src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
966
src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
File diff suppressed because it is too large
Load diff
12
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
12
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/printf/printf.go
generated
vendored
|
|
@ -515,8 +515,7 @@ func checkPrintf(pass *analysis.Pass, fileVersion string, kind Kind, call *ast.C
|
||||||
// finds are sometimes unlikely or inconsequential, and may not be worth
|
// finds are sometimes unlikely or inconsequential, and may not be worth
|
||||||
// fixing for some users. Gating on language version allows us to avoid
|
// fixing for some users. Gating on language version allows us to avoid
|
||||||
// breaking existing tests and CI scripts.
|
// breaking existing tests and CI scripts.
|
||||||
if !suppressNonconstants &&
|
if idx == len(call.Args)-1 &&
|
||||||
idx == len(call.Args)-1 &&
|
|
||||||
fileVersion != "" && // fail open
|
fileVersion != "" && // fail open
|
||||||
versions.AtLeast(fileVersion, "go1.24") {
|
versions.AtLeast(fileVersion, "go1.24") {
|
||||||
|
|
||||||
|
|
@ -1005,15 +1004,6 @@ func (ss stringSet) Set(flag string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// suppressNonconstants suppresses reporting printf calls with
|
|
||||||
// non-constant formatting strings (proposal #60529) when true.
|
|
||||||
//
|
|
||||||
// This variable is to allow for staging the transition to newer
|
|
||||||
// versions of x/tools by vendoring.
|
|
||||||
//
|
|
||||||
// Remove this after the 1.24 release.
|
|
||||||
var suppressNonconstants bool
|
|
||||||
|
|
||||||
// isHex reports whether b is a hex digit.
|
// isHex reports whether b is a hex digit.
|
||||||
func isHex(b byte) bool {
|
func isHex(b byte) bool {
|
||||||
return '0' <= b && b <= '9' ||
|
return '0' <= b && b <= '9' ||
|
||||||
|
|
|
||||||
6
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdversion/stdversion.go
generated
vendored
6
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/stdversion/stdversion.go
generated
vendored
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"go/ast"
|
"go/ast"
|
||||||
"go/build"
|
"go/build"
|
||||||
"go/types"
|
"go/types"
|
||||||
"regexp"
|
|
||||||
"slices"
|
"slices"
|
||||||
|
|
||||||
"golang.org/x/tools/go/analysis"
|
"golang.org/x/tools/go/analysis"
|
||||||
|
|
@ -114,11 +113,6 @@ func run(pass *analysis.Pass) (any, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches cgo generated comment as well as the proposed standard:
|
|
||||||
//
|
|
||||||
// https://golang.org/s/generatedcode
|
|
||||||
var generatedRx = regexp.MustCompile(`// .*DO NOT EDIT\.?`)
|
|
||||||
|
|
||||||
// origin returns the original uninstantiated symbol for obj.
|
// origin returns the original uninstantiated symbol for obj.
|
||||||
func origin(obj types.Object) types.Object {
|
func origin(obj types.Object) types.Object {
|
||||||
switch obj := obj.(type) {
|
switch obj := obj.(type) {
|
||||||
|
|
|
||||||
20
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
generated
vendored
20
src/cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag/structtag.go
generated
vendored
|
|
@ -17,6 +17,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"golang.org/x/tools/go/analysis"
|
"golang.org/x/tools/go/analysis"
|
||||||
"golang.org/x/tools/go/analysis/passes/inspect"
|
"golang.org/x/tools/go/analysis/passes/inspect"
|
||||||
"golang.org/x/tools/go/ast/inspector"
|
"golang.org/x/tools/go/ast/inspector"
|
||||||
|
|
@ -100,7 +102,11 @@ func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, s
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := validateStructTag(tag); err != nil {
|
if err := validateStructTag(tag); err != nil {
|
||||||
pass.Reportf(field.Pos(), "struct field tag %#q not compatible with reflect.StructTag.Get: %s", tag, err)
|
pass.Report(analysis.Diagnostic{
|
||||||
|
Pos: field.Pos(),
|
||||||
|
End: field.Pos() + token.Pos(len(field.Name())),
|
||||||
|
Message: fmt.Sprintf("struct field tag %#q not compatible with reflect.StructTag.Get: %s", tag, err),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for use of json or xml tags with unexported fields.
|
// Check for use of json or xml tags with unexported fields.
|
||||||
|
|
@ -122,7 +128,11 @@ func checkCanonicalFieldTag(pass *analysis.Pass, field *types.Var, tag string, s
|
||||||
// ignored.
|
// ignored.
|
||||||
case "", "-":
|
case "", "-":
|
||||||
default:
|
default:
|
||||||
pass.Reportf(field.Pos(), "struct field %s has %s tag but is not exported", field.Name(), enc)
|
pass.Report(analysis.Diagnostic{
|
||||||
|
Pos: field.Pos(),
|
||||||
|
End: field.Pos() + token.Pos(len(field.Name())),
|
||||||
|
Message: fmt.Sprintf("struct field %s has %s tag but is not exported", field.Name(), enc),
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +200,11 @@ func checkTagDuplicates(pass *analysis.Pass, tag, key string, nearest, field *ty
|
||||||
alsoPos.Filename = rel
|
alsoPos.Filename = rel
|
||||||
}
|
}
|
||||||
|
|
||||||
pass.Reportf(nearest.Pos(), "struct field %s repeats %s tag %q also at %s", field.Name(), key, val, alsoPos)
|
pass.Report(analysis.Diagnostic{
|
||||||
|
Pos: nearest.Pos(),
|
||||||
|
End: nearest.Pos() + token.Pos(len(nearest.Name())),
|
||||||
|
Message: fmt.Sprintf("struct field %s repeats %s tag %q also at %s", field.Name(), key, val, alsoPos),
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
seen.Set(key, val, level, field.Pos())
|
seen.Set(key, val, level, field.Pos())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
generated
vendored
10
src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
generated
vendored
|
|
@ -73,6 +73,7 @@ type Config struct {
|
||||||
PackageVetx map[string]string // maps package path to file of fact information
|
PackageVetx map[string]string // maps package path to file of fact information
|
||||||
VetxOnly bool // run analysis only for facts, not diagnostics
|
VetxOnly bool // run analysis only for facts, not diagnostics
|
||||||
VetxOutput string // where to write file of fact information
|
VetxOutput string // where to write file of fact information
|
||||||
|
Stdout string // write stdout (e.g. JSON, unified diff) to this file
|
||||||
SucceedOnTypecheckFailure bool
|
SucceedOnTypecheckFailure bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,6 +143,15 @@ func Run(configFile string, analyzers []*analysis.Analyzer) {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redirect stdout to a file as requested.
|
||||||
|
if cfg.Stdout != "" {
|
||||||
|
f, err := os.Create(cfg.Stdout)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
os.Stdout = f
|
||||||
|
}
|
||||||
|
|
||||||
fset := token.NewFileSet()
|
fset := token.NewFileSet()
|
||||||
results, err := run(fset, cfg, analyzers)
|
results, err := run(fset, cfg, analyzers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
2
src/cmd/vendor/golang.org/x/tools/go/ast/inspector/cursor.go
generated
vendored
2
src/cmd/vendor/golang.org/x/tools/go/ast/inspector/cursor.go
generated
vendored
|
|
@ -40,7 +40,7 @@ type Cursor struct {
|
||||||
// Root returns a cursor for the virtual root node,
|
// Root returns a cursor for the virtual root node,
|
||||||
// whose children are the files provided to [New].
|
// whose children are the files provided to [New].
|
||||||
//
|
//
|
||||||
// Its [Cursor.Node] and [Cursor.Stack] methods return nil.
|
// Its [Cursor.Node] method return nil.
|
||||||
func (in *Inspector) Root() Cursor {
|
func (in *Inspector) Root() Cursor {
|
||||||
return Cursor{in, -1}
|
return Cursor{in, -1}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go
generated
vendored
5
src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go
generated
vendored
|
|
@ -53,7 +53,6 @@ import (
|
||||||
//
|
//
|
||||||
// The entry point is Blocks[0]; there may be multiple return blocks.
|
// The entry point is Blocks[0]; there may be multiple return blocks.
|
||||||
type CFG struct {
|
type CFG struct {
|
||||||
fset *token.FileSet
|
|
||||||
Blocks []*Block // block[0] is entry; order otherwise undefined
|
Blocks []*Block // block[0] is entry; order otherwise undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,6 +62,10 @@ type CFG struct {
|
||||||
// A block may have 0-2 successors: zero for a return block or a block
|
// A block may have 0-2 successors: zero for a return block or a block
|
||||||
// that calls a function such as panic that never returns; one for a
|
// that calls a function such as panic that never returns; one for a
|
||||||
// normal (jump) block; and two for a conditional (if) block.
|
// normal (jump) block; and two for a conditional (if) block.
|
||||||
|
//
|
||||||
|
// In a conditional block, the last entry in Nodes is the condition and always
|
||||||
|
// an [ast.Expr], Succs[0] is the successor if the condition is true, and
|
||||||
|
// Succs[1] is the successor if the condition is false.
|
||||||
type Block struct {
|
type Block struct {
|
||||||
Nodes []ast.Node // statements, expressions, and ValueSpecs
|
Nodes []ast.Node // statements, expressions, and ValueSpecs
|
||||||
Succs []*Block // successor nodes in the graph
|
Succs []*Block // successor nodes in the graph
|
||||||
|
|
|
||||||
5
src/cmd/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go
generated
vendored
5
src/cmd/vendor/golang.org/x/tools/go/types/objectpath/objectpath.go
generated
vendored
|
|
@ -698,7 +698,10 @@ func Object(pkg *types.Package, p Path) (types.Object, error) {
|
||||||
} else if false && aliases.Enabled() {
|
} else if false && aliases.Enabled() {
|
||||||
// The Enabled check is too expensive, so for now we
|
// The Enabled check is too expensive, so for now we
|
||||||
// simply assume that aliases are not enabled.
|
// simply assume that aliases are not enabled.
|
||||||
// TODO(adonovan): replace with "if true {" when go1.24 is assured.
|
//
|
||||||
|
// Now that go1.24 is assured, we should be able to
|
||||||
|
// replace this with "if true {", but it causes tests
|
||||||
|
// to fail. TODO(adonovan): investigate.
|
||||||
return nil, fmt.Errorf("cannot apply %q to %s (got %T, want alias)", code, t, t)
|
return nil, fmt.Errorf("cannot apply %q to %s (got %T, want alias)", code, t, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
17
src/cmd/vendor/golang.org/x/tools/go/types/typeutil/map.go
generated
vendored
17
src/cmd/vendor/golang.org/x/tools/go/types/typeutil/map.go
generated
vendored
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"go/types"
|
"go/types"
|
||||||
"hash/maphash"
|
"hash/maphash"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"golang.org/x/tools/internal/typeparams"
|
"golang.org/x/tools/internal/typeparams"
|
||||||
)
|
)
|
||||||
|
|
@ -380,22 +379,8 @@ var theSeed = maphash.MakeSeed()
|
||||||
func (hasher) hashTypeName(tname *types.TypeName) uint32 {
|
func (hasher) hashTypeName(tname *types.TypeName) uint32 {
|
||||||
// Since types.Identical uses == to compare TypeNames,
|
// Since types.Identical uses == to compare TypeNames,
|
||||||
// the Hash function uses maphash.Comparable.
|
// the Hash function uses maphash.Comparable.
|
||||||
// TODO(adonovan): or will, when it becomes available in go1.24.
|
hash := maphash.Comparable(theSeed, tname)
|
||||||
// In the meantime we use the pointer's numeric value.
|
|
||||||
//
|
|
||||||
// hash := maphash.Comparable(theSeed, tname)
|
|
||||||
//
|
|
||||||
// (Another approach would be to hash the name and package
|
|
||||||
// path, and whether or not it is a package-level typename. It
|
|
||||||
// is rare for a package to define multiple local types with
|
|
||||||
// the same name.)
|
|
||||||
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
|
||||||
|
|
|
||||||
64
src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go
generated
vendored
64
src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go
generated
vendored
|
|
@ -22,6 +22,7 @@ import (
|
||||||
|
|
||||||
"golang.org/x/tools/go/analysis"
|
"golang.org/x/tools/go/analysis"
|
||||||
"golang.org/x/tools/go/ast/inspector"
|
"golang.org/x/tools/go/ast/inspector"
|
||||||
|
"golang.org/x/tools/internal/moreiters"
|
||||||
"golang.org/x/tools/internal/typesinternal"
|
"golang.org/x/tools/internal/typesinternal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -276,19 +277,27 @@ func AddImport(info *types.Info, file *ast.File, preferredName, pkgpath, member
|
||||||
before = decl0.Doc
|
before = decl0.Doc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the first decl is an import group, add this new import at the end.
|
|
||||||
if gd, ok := before.(*ast.GenDecl); ok && gd.Tok == token.IMPORT && gd.Rparen.IsValid() {
|
if gd, ok := before.(*ast.GenDecl); ok && gd.Tok == token.IMPORT && gd.Rparen.IsValid() {
|
||||||
pos = gd.Rparen
|
// Have existing grouped import ( ... ) decl.
|
||||||
// if it's a std lib, we should append it at the beginning of import group.
|
if IsStdPackage(pkgpath) && len(gd.Specs) > 0 {
|
||||||
// otherwise we may see the std package is put at the last behind a 3rd module which doesn't follow our convention.
|
// Add spec for a std package before
|
||||||
// besides, gofmt doesn't help in this case.
|
// first existing spec, followed by
|
||||||
if IsStdPackage(pkgpath) && len(gd.Specs) != 0 {
|
// a blank line if the next one is non-std.
|
||||||
pos = gd.Specs[0].Pos()
|
first := gd.Specs[0].(*ast.ImportSpec)
|
||||||
|
pos = first.Pos()
|
||||||
|
if !IsStdPackage(first.Path.Value) {
|
||||||
|
newText += "\n"
|
||||||
|
}
|
||||||
newText += "\n\t"
|
newText += "\n\t"
|
||||||
} else {
|
} else {
|
||||||
|
// Add spec at end of group.
|
||||||
|
pos = gd.Rparen
|
||||||
newText = "\t" + newText + "\n"
|
newText = "\t" + newText + "\n"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// No import decl, or non-grouped import.
|
||||||
|
// Add a new import decl before first decl.
|
||||||
|
// (gofmt will merge multiple import decls.)
|
||||||
pos = before.Pos()
|
pos = before.Pos()
|
||||||
newText = "import " + newText + "\n\n"
|
newText = "import " + newText + "\n\n"
|
||||||
}
|
}
|
||||||
|
|
@ -519,24 +528,11 @@ func CanImport(from, to string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteStmt returns the edits to remove stmt if it is contained
|
// DeleteStmt returns the edits to remove the [ast.Stmt] identified by
|
||||||
// in a BlockStmt, CaseClause, CommClause, or is the STMT in switch STMT; ... {...}
|
// curStmt, if it is contained within a BlockStmt, CaseClause,
|
||||||
// The report function abstracts gopls' bug.Report.
|
// CommClause, or is the STMT in switch STMT; ... {...}. It returns nil otherwise.
|
||||||
func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report func(string, ...any)) []analysis.TextEdit {
|
func DeleteStmt(fset *token.FileSet, curStmt inspector.Cursor) []analysis.TextEdit {
|
||||||
// TODO: pass in the cursor to a ast.Stmt. callers should provide the Cursor
|
stmt := curStmt.Node().(ast.Stmt)
|
||||||
insp := inspector.New([]*ast.File{astFile})
|
|
||||||
root := insp.Root()
|
|
||||||
cstmt, ok := root.FindNode(stmt)
|
|
||||||
if !ok {
|
|
||||||
report("%s not found in file", stmt.Pos())
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
// some paranoia
|
|
||||||
if !stmt.Pos().IsValid() || !stmt.End().IsValid() {
|
|
||||||
report("%s: stmt has invalid position", stmt.Pos())
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the stmt is on a line by itself delete the whole line
|
// if the stmt is on a line by itself delete the whole line
|
||||||
// otherwise just delete the statement.
|
// otherwise just delete the statement.
|
||||||
|
|
||||||
|
|
@ -562,7 +558,7 @@ func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report fu
|
||||||
// (removing the blocks requires more rewriting than this routine would do)
|
// (removing the blocks requires more rewriting than this routine would do)
|
||||||
// CommCase = "case" ( SendStmt | RecvStmt ) | "default" .
|
// CommCase = "case" ( SendStmt | RecvStmt ) | "default" .
|
||||||
// (removing the stmt requires more rewriting, and it's unclear what the user means)
|
// (removing the stmt requires more rewriting, and it's unclear what the user means)
|
||||||
switch parent := cstmt.Parent().Node().(type) {
|
switch parent := curStmt.Parent().Node().(type) {
|
||||||
case *ast.SwitchStmt:
|
case *ast.SwitchStmt:
|
||||||
limits(parent.Switch, parent.Body.Lbrace)
|
limits(parent.Switch, parent.Body.Lbrace)
|
||||||
case *ast.TypeSwitchStmt:
|
case *ast.TypeSwitchStmt:
|
||||||
|
|
@ -573,12 +569,12 @@ func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report fu
|
||||||
case *ast.BlockStmt:
|
case *ast.BlockStmt:
|
||||||
limits(parent.Lbrace, parent.Rbrace)
|
limits(parent.Lbrace, parent.Rbrace)
|
||||||
case *ast.CommClause:
|
case *ast.CommClause:
|
||||||
limits(parent.Colon, cstmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace)
|
limits(parent.Colon, curStmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace)
|
||||||
if parent.Comm == stmt {
|
if parent.Comm == stmt {
|
||||||
return nil // maybe the user meant to remove the entire CommClause?
|
return nil // maybe the user meant to remove the entire CommClause?
|
||||||
}
|
}
|
||||||
case *ast.CaseClause:
|
case *ast.CaseClause:
|
||||||
limits(parent.Colon, cstmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace)
|
limits(parent.Colon, curStmt.Parent().Parent().Node().(*ast.BlockStmt).Rbrace)
|
||||||
case *ast.ForStmt:
|
case *ast.ForStmt:
|
||||||
limits(parent.For, parent.Body.Lbrace)
|
limits(parent.For, parent.Body.Lbrace)
|
||||||
|
|
||||||
|
|
@ -586,15 +582,15 @@ func DeleteStmt(fset *token.FileSet, astFile *ast.File, stmt ast.Stmt, report fu
|
||||||
return nil // not one of ours
|
return nil // not one of ours
|
||||||
}
|
}
|
||||||
|
|
||||||
if prev, found := cstmt.PrevSibling(); found && lineOf(prev.Node().End()) == stmtStartLine {
|
if prev, found := curStmt.PrevSibling(); found && lineOf(prev.Node().End()) == stmtStartLine {
|
||||||
from = prev.Node().End() // preceding statement ends on same line
|
from = prev.Node().End() // preceding statement ends on same line
|
||||||
}
|
}
|
||||||
if next, found := cstmt.NextSibling(); found && lineOf(next.Node().Pos()) == stmtEndLine {
|
if next, found := curStmt.NextSibling(); found && lineOf(next.Node().Pos()) == stmtEndLine {
|
||||||
to = next.Node().Pos() // following statement begins on same line
|
to = next.Node().Pos() // following statement begins on same line
|
||||||
}
|
}
|
||||||
// and now for the comments
|
// and now for the comments
|
||||||
Outer:
|
Outer:
|
||||||
for _, cg := range astFile.Comments {
|
for _, cg := range enclosingFile(curStmt).Comments {
|
||||||
for _, co := range cg.List {
|
for _, co := range cg.List {
|
||||||
if lineOf(co.End()) < stmtStartLine {
|
if lineOf(co.End()) < stmtStartLine {
|
||||||
continue
|
continue
|
||||||
|
|
@ -681,3 +677,9 @@ type tokenRange struct{ StartPos, EndPos token.Pos }
|
||||||
|
|
||||||
func (r tokenRange) Pos() token.Pos { return r.StartPos }
|
func (r tokenRange) Pos() token.Pos { return r.StartPos }
|
||||||
func (r tokenRange) End() token.Pos { return r.EndPos }
|
func (r tokenRange) End() token.Pos { return r.EndPos }
|
||||||
|
|
||||||
|
// enclosingFile returns the syntax tree for the file enclosing c.
|
||||||
|
func enclosingFile(c inspector.Cursor) *ast.File {
|
||||||
|
c, _ = moreiters.First(c.Enclosing((*ast.File)(nil)))
|
||||||
|
return c.Node().(*ast.File)
|
||||||
|
}
|
||||||
|
|
|
||||||
99
src/cmd/vendor/golang.org/x/tools/internal/astutil/equal.go
generated
vendored
Normal file
99
src/cmd/vendor/golang.org/x/tools/internal/astutil/equal.go
generated
vendored
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
package astutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
"go/token"
|
||||||
|
"reflect"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Equal reports whether two nodes are structurally equal,
|
||||||
|
// ignoring fields of type [token.Pos], [ast.Object],
|
||||||
|
// and [ast.Scope], and comments.
|
||||||
|
//
|
||||||
|
// The operands x and y may be nil.
|
||||||
|
// A nil slice is not equal to an empty slice.
|
||||||
|
//
|
||||||
|
// The provided function determines whether two identifiers
|
||||||
|
// should be considered identical.
|
||||||
|
func Equal(x, y ast.Node, identical func(x, y *ast.Ident) bool) bool {
|
||||||
|
if x == nil || y == nil {
|
||||||
|
return x == y
|
||||||
|
}
|
||||||
|
return equal(reflect.ValueOf(x), reflect.ValueOf(y), identical)
|
||||||
|
}
|
||||||
|
|
||||||
|
func equal(x, y reflect.Value, identical func(x, y *ast.Ident) bool) bool {
|
||||||
|
// Ensure types are the same
|
||||||
|
if x.Type() != y.Type() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
switch x.Kind() {
|
||||||
|
case reflect.Pointer:
|
||||||
|
if x.IsNil() || y.IsNil() {
|
||||||
|
return x.IsNil() == y.IsNil()
|
||||||
|
}
|
||||||
|
switch t := x.Interface().(type) {
|
||||||
|
// Skip fields of types potentially involved in cycles.
|
||||||
|
case *ast.Object, *ast.Scope, *ast.CommentGroup:
|
||||||
|
return true
|
||||||
|
case *ast.Ident:
|
||||||
|
return identical(t, y.Interface().(*ast.Ident))
|
||||||
|
default:
|
||||||
|
return equal(x.Elem(), y.Elem(), identical)
|
||||||
|
}
|
||||||
|
|
||||||
|
case reflect.Interface:
|
||||||
|
if x.IsNil() || y.IsNil() {
|
||||||
|
return x.IsNil() == y.IsNil()
|
||||||
|
}
|
||||||
|
return equal(x.Elem(), y.Elem(), identical)
|
||||||
|
|
||||||
|
case reflect.Struct:
|
||||||
|
for i := range x.NumField() {
|
||||||
|
xf := x.Field(i)
|
||||||
|
yf := y.Field(i)
|
||||||
|
// Skip position fields.
|
||||||
|
if xpos, ok := xf.Interface().(token.Pos); ok {
|
||||||
|
ypos := yf.Interface().(token.Pos)
|
||||||
|
// Numeric value of a Pos is not significant but its "zeroness" is,
|
||||||
|
// because it is often significant, e.g. CallExpr.Variadic(Ellipsis), ChanType.Arrow.
|
||||||
|
if xpos.IsValid() != ypos.IsValid() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else if !equal(xf, yf, identical) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
|
||||||
|
case reflect.Slice:
|
||||||
|
if x.IsNil() || y.IsNil() {
|
||||||
|
return x.IsNil() == y.IsNil()
|
||||||
|
}
|
||||||
|
if x.Len() != y.Len() {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for i := range x.Len() {
|
||||||
|
if !equal(x.Index(i), y.Index(i), identical) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
|
||||||
|
case reflect.String:
|
||||||
|
return x.String() == y.String()
|
||||||
|
|
||||||
|
case reflect.Bool:
|
||||||
|
return x.Bool() == y.Bool()
|
||||||
|
|
||||||
|
case reflect.Int:
|
||||||
|
return x.Int() == y.Int()
|
||||||
|
|
||||||
|
default:
|
||||||
|
panic(x)
|
||||||
|
}
|
||||||
|
}
|
||||||
35
src/cmd/vendor/golang.org/x/tools/internal/astutil/fields.go
generated
vendored
Normal file
35
src/cmd/vendor/golang.org/x/tools/internal/astutil/fields.go
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
// 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 astutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
"iter"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FlatFields 'flattens' an ast.FieldList, returning an iterator over each
|
||||||
|
// (name, field) combination in the list. For unnamed fields, the identifier is
|
||||||
|
// nil.
|
||||||
|
func FlatFields(list *ast.FieldList) iter.Seq2[*ast.Ident, *ast.Field] {
|
||||||
|
return func(yield func(*ast.Ident, *ast.Field) bool) {
|
||||||
|
if list == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, field := range list.List {
|
||||||
|
if len(field.Names) == 0 {
|
||||||
|
if !yield(nil, field) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for _, name := range field.Names {
|
||||||
|
if !yield(name, field) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
72
src/cmd/vendor/golang.org/x/tools/internal/astutil/purge.go
generated
vendored
Normal file
72
src/cmd/vendor/golang.org/x/tools/internal/astutil/purge.go
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
// Package astutil provides various AST utility functions for gopls.
|
||||||
|
package astutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"go/scanner"
|
||||||
|
"go/token"
|
||||||
|
)
|
||||||
|
|
||||||
|
// PurgeFuncBodies returns a copy of src in which the contents of each
|
||||||
|
// outermost {...} region except struct and interface types have been
|
||||||
|
// deleted. This reduces the amount of work required to parse the
|
||||||
|
// top-level declarations.
|
||||||
|
//
|
||||||
|
// PurgeFuncBodies does not preserve newlines or position information.
|
||||||
|
// Also, if the input is invalid, parsing the output of
|
||||||
|
// PurgeFuncBodies may result in a different tree due to its effects
|
||||||
|
// on parser error recovery.
|
||||||
|
func PurgeFuncBodies(src []byte) []byte {
|
||||||
|
// Destroy the content of any {...}-bracketed regions that are
|
||||||
|
// not immediately preceded by a "struct" or "interface"
|
||||||
|
// token. That includes function bodies, composite literals,
|
||||||
|
// switch/select bodies, and all blocks of statements.
|
||||||
|
// This will lead to non-void functions that don't have return
|
||||||
|
// statements, which of course is a type error, but that's ok.
|
||||||
|
|
||||||
|
var out bytes.Buffer
|
||||||
|
file := token.NewFileSet().AddFile("", -1, len(src))
|
||||||
|
var sc scanner.Scanner
|
||||||
|
sc.Init(file, src, nil, 0)
|
||||||
|
var prev token.Token
|
||||||
|
var cursor int // last consumed src offset
|
||||||
|
var braces []token.Pos // stack of unclosed braces or -1 for struct/interface type
|
||||||
|
for {
|
||||||
|
pos, tok, _ := sc.Scan()
|
||||||
|
if tok == token.EOF {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
switch tok {
|
||||||
|
case token.COMMENT:
|
||||||
|
// TODO(adonovan): opt: skip, to save an estimated 20% of time.
|
||||||
|
|
||||||
|
case token.LBRACE:
|
||||||
|
if prev == token.STRUCT || prev == token.INTERFACE {
|
||||||
|
pos = -1
|
||||||
|
}
|
||||||
|
braces = append(braces, pos)
|
||||||
|
|
||||||
|
case token.RBRACE:
|
||||||
|
if last := len(braces) - 1; last >= 0 {
|
||||||
|
top := braces[last]
|
||||||
|
braces = braces[:last]
|
||||||
|
if top < 0 {
|
||||||
|
// struct/interface type: leave alone
|
||||||
|
} else if len(braces) == 0 { // toplevel only
|
||||||
|
// Delete {...} body.
|
||||||
|
start := file.Offset(top)
|
||||||
|
end := file.Offset(pos)
|
||||||
|
out.Write(src[cursor : start+len("{")])
|
||||||
|
cursor = end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
prev = tok
|
||||||
|
}
|
||||||
|
out.Write(src[cursor:])
|
||||||
|
return out.Bytes()
|
||||||
|
}
|
||||||
59
src/cmd/vendor/golang.org/x/tools/internal/astutil/stringlit.go
generated
vendored
Normal file
59
src/cmd/vendor/golang.org/x/tools/internal/astutil/stringlit.go
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
// 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 astutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"go/ast"
|
||||||
|
"go/token"
|
||||||
|
"strconv"
|
||||||
|
"unicode/utf8"
|
||||||
|
)
|
||||||
|
|
||||||
|
// RangeInStringLiteral calculates the positional range within a string literal
|
||||||
|
// corresponding to the specified start and end byte offsets within the logical string.
|
||||||
|
func RangeInStringLiteral(lit *ast.BasicLit, start, end int) (token.Pos, token.Pos, error) {
|
||||||
|
startPos, err := PosInStringLiteral(lit, start)
|
||||||
|
if err != nil {
|
||||||
|
return 0, 0, fmt.Errorf("start: %v", err)
|
||||||
|
}
|
||||||
|
endPos, err := PosInStringLiteral(lit, end)
|
||||||
|
if err != nil {
|
||||||
|
return 0, 0, fmt.Errorf("end: %v", err)
|
||||||
|
}
|
||||||
|
return startPos, endPos, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// PosInStringLiteral returns the position within a string literal
|
||||||
|
// corresponding to the specified byte offset within the logical
|
||||||
|
// string that it denotes.
|
||||||
|
func PosInStringLiteral(lit *ast.BasicLit, offset int) (token.Pos, error) {
|
||||||
|
raw := lit.Value
|
||||||
|
|
||||||
|
value, err := strconv.Unquote(raw)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if !(0 <= offset && offset <= len(value)) {
|
||||||
|
return 0, fmt.Errorf("invalid offset")
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove quotes
|
||||||
|
quote := raw[0] // '"' or '`'
|
||||||
|
raw = raw[1 : len(raw)-1]
|
||||||
|
|
||||||
|
var (
|
||||||
|
i = 0 // byte index within logical value
|
||||||
|
pos = lit.ValuePos + 1 // position within literal
|
||||||
|
)
|
||||||
|
for raw != "" && i < offset {
|
||||||
|
r, _, rest, _ := strconv.UnquoteChar(raw, quote) // can't fail
|
||||||
|
sz := len(raw) - len(rest) // length of literal char in raw bytes
|
||||||
|
pos += token.Pos(sz)
|
||||||
|
raw = raw[sz:]
|
||||||
|
i += utf8.RuneLen(r)
|
||||||
|
}
|
||||||
|
return pos, nil
|
||||||
|
}
|
||||||
61
src/cmd/vendor/golang.org/x/tools/internal/astutil/unpack.go
generated
vendored
Normal file
61
src/cmd/vendor/golang.org/x/tools/internal/astutil/unpack.go
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
package astutil
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go/ast"
|
||||||
|
|
||||||
|
"golang.org/x/tools/internal/typeparams"
|
||||||
|
)
|
||||||
|
|
||||||
|
// UnpackRecv unpacks a receiver type expression, reporting whether it is a
|
||||||
|
// pointer receiver, along with the type name identifier and any receiver type
|
||||||
|
// parameter identifiers.
|
||||||
|
//
|
||||||
|
// Copied (with modifications) from go/types.
|
||||||
|
func UnpackRecv(rtyp ast.Expr) (ptr bool, rname *ast.Ident, tparams []*ast.Ident) {
|
||||||
|
L: // unpack receiver type
|
||||||
|
// This accepts invalid receivers such as ***T and does not
|
||||||
|
// work for other invalid receivers, but we don't care. The
|
||||||
|
// validity of receiver expressions is checked elsewhere.
|
||||||
|
for {
|
||||||
|
switch t := rtyp.(type) {
|
||||||
|
case *ast.ParenExpr:
|
||||||
|
rtyp = t.X
|
||||||
|
case *ast.StarExpr:
|
||||||
|
ptr = true
|
||||||
|
rtyp = t.X
|
||||||
|
default:
|
||||||
|
break L
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// unpack type parameters, if any
|
||||||
|
switch rtyp.(type) {
|
||||||
|
case *ast.IndexExpr, *ast.IndexListExpr:
|
||||||
|
var indices []ast.Expr
|
||||||
|
rtyp, _, indices, _ = typeparams.UnpackIndexExpr(rtyp)
|
||||||
|
for _, arg := range indices {
|
||||||
|
var par *ast.Ident
|
||||||
|
switch arg := arg.(type) {
|
||||||
|
case *ast.Ident:
|
||||||
|
par = arg
|
||||||
|
default:
|
||||||
|
// ignore errors
|
||||||
|
}
|
||||||
|
if par == nil {
|
||||||
|
par = &ast.Ident{NamePos: arg.Pos(), Name: "_"}
|
||||||
|
}
|
||||||
|
tparams = append(tparams, par)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// unpack receiver name
|
||||||
|
if name, _ := rtyp.(*ast.Ident); name != nil {
|
||||||
|
rname = name
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
74
src/cmd/vendor/golang.org/x/tools/internal/astutil/util.go
generated
vendored
74
src/cmd/vendor/golang.org/x/tools/internal/astutil/util.go
generated
vendored
|
|
@ -5,59 +5,10 @@
|
||||||
package astutil
|
package astutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"go/ast"
|
"go/ast"
|
||||||
"go/token"
|
"go/token"
|
||||||
"strconv"
|
|
||||||
"unicode/utf8"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeInStringLiteral calculates the positional range within a string literal
|
|
||||||
// corresponding to the specified start and end byte offsets within the logical string.
|
|
||||||
func RangeInStringLiteral(lit *ast.BasicLit, start, end int) (token.Pos, token.Pos, error) {
|
|
||||||
startPos, err := PosInStringLiteral(lit, start)
|
|
||||||
if err != nil {
|
|
||||||
return 0, 0, fmt.Errorf("start: %v", err)
|
|
||||||
}
|
|
||||||
endPos, err := PosInStringLiteral(lit, end)
|
|
||||||
if err != nil {
|
|
||||||
return 0, 0, fmt.Errorf("end: %v", err)
|
|
||||||
}
|
|
||||||
return startPos, endPos, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// PosInStringLiteral returns the position within a string literal
|
|
||||||
// corresponding to the specified byte offset within the logical
|
|
||||||
// string that it denotes.
|
|
||||||
func PosInStringLiteral(lit *ast.BasicLit, offset int) (token.Pos, error) {
|
|
||||||
raw := lit.Value
|
|
||||||
|
|
||||||
value, err := strconv.Unquote(raw)
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
if !(0 <= offset && offset <= len(value)) {
|
|
||||||
return 0, fmt.Errorf("invalid offset")
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove quotes
|
|
||||||
quote := raw[0] // '"' or '`'
|
|
||||||
raw = raw[1 : len(raw)-1]
|
|
||||||
|
|
||||||
var (
|
|
||||||
i = 0 // byte index within logical value
|
|
||||||
pos = lit.ValuePos + 1 // position within literal
|
|
||||||
)
|
|
||||||
for raw != "" && i < offset {
|
|
||||||
r, _, rest, _ := strconv.UnquoteChar(raw, quote) // can't fail
|
|
||||||
sz := len(raw) - len(rest) // length of literal char in raw bytes
|
|
||||||
pos += token.Pos(sz)
|
|
||||||
raw = raw[sz:]
|
|
||||||
i += utf8.RuneLen(r)
|
|
||||||
}
|
|
||||||
return pos, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// PreorderStack traverses the tree rooted at root,
|
// PreorderStack traverses the tree rooted at root,
|
||||||
// calling f before visiting each node.
|
// calling f before visiting each node.
|
||||||
//
|
//
|
||||||
|
|
@ -91,3 +42,28 @@ func PreorderStack(root ast.Node, stack []ast.Node, f func(n ast.Node, stack []a
|
||||||
panic("push/pop mismatch")
|
panic("push/pop mismatch")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NodeContains reports whether the Pos/End range of node n encloses
|
||||||
|
// the given position pos.
|
||||||
|
//
|
||||||
|
// It is inclusive of both end points, to allow hovering (etc) when
|
||||||
|
// the cursor is immediately after a node.
|
||||||
|
//
|
||||||
|
// For unfortunate historical reasons, the Pos/End extent of an
|
||||||
|
// ast.File runs from the start of its package declaration---excluding
|
||||||
|
// copyright comments, build tags, and package documentation---to the
|
||||||
|
// end of its last declaration, excluding any trailing comments. So,
|
||||||
|
// as a special case, if n is an [ast.File], NodeContains uses
|
||||||
|
// n.FileStart <= pos && pos <= n.FileEnd to report whether the
|
||||||
|
// position lies anywhere within the file.
|
||||||
|
//
|
||||||
|
// Precondition: n must not be nil.
|
||||||
|
func NodeContains(n ast.Node, pos token.Pos) bool {
|
||||||
|
var start, end token.Pos
|
||||||
|
if file, ok := n.(*ast.File); ok {
|
||||||
|
start, end = file.FileStart, file.FileEnd // entire file
|
||||||
|
} else {
|
||||||
|
start, end = n.Pos(), n.End()
|
||||||
|
}
|
||||||
|
return start <= pos && pos <= end
|
||||||
|
}
|
||||||
|
|
|
||||||
47
src/cmd/vendor/golang.org/x/tools/internal/moreiters/iters.go
generated
vendored
Normal file
47
src/cmd/vendor/golang.org/x/tools/internal/moreiters/iters.go
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
// 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 moreiters
|
||||||
|
|
||||||
|
import "iter"
|
||||||
|
|
||||||
|
// First returns the first value of seq and true.
|
||||||
|
// If seq is empty, it returns the zero value of T and false.
|
||||||
|
func First[T any](seq iter.Seq[T]) (z T, ok bool) {
|
||||||
|
for t := range seq {
|
||||||
|
return t, true
|
||||||
|
}
|
||||||
|
return z, false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Contains reports whether x is an element of the sequence seq.
|
||||||
|
func Contains[T comparable](seq iter.Seq[T], x T) bool {
|
||||||
|
for cand := range seq {
|
||||||
|
if cand == x {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Every reports whether every pred(t) for t in seq returns true,
|
||||||
|
// stopping at the first false element.
|
||||||
|
func Every[T any](seq iter.Seq[T], pred func(T) bool) bool {
|
||||||
|
for t := range seq {
|
||||||
|
if !pred(t) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Any reports whether any pred(t) for t in seq returns true.
|
||||||
|
func Any[T any](seq iter.Seq[T], pred func(T) bool) bool {
|
||||||
|
for t := range seq {
|
||||||
|
if pred(t) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
23
src/cmd/vendor/modules.txt
vendored
23
src/cmd/vendor/modules.txt
vendored
|
|
@ -28,8 +28,8 @@ golang.org/x/arch/x86/x86asm
|
||||||
# golang.org/x/build v0.0.0-20250806225920-b7c66c047964
|
# golang.org/x/build v0.0.0-20250806225920-b7c66c047964
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.23.0
|
||||||
golang.org/x/build/relnote
|
golang.org/x/build/relnote
|
||||||
# golang.org/x/mod v0.27.0
|
# golang.org/x/mod v0.28.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.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
|
||||||
|
|
@ -39,17 +39,17 @@ golang.org/x/mod/sumdb/dirhash
|
||||||
golang.org/x/mod/sumdb/note
|
golang.org/x/mod/sumdb/note
|
||||||
golang.org/x/mod/sumdb/tlog
|
golang.org/x/mod/sumdb/tlog
|
||||||
golang.org/x/mod/zip
|
golang.org/x/mod/zip
|
||||||
# golang.org/x/sync v0.16.0
|
# golang.org/x/sync v0.17.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/sync/errgroup
|
golang.org/x/sync/errgroup
|
||||||
golang.org/x/sync/semaphore
|
golang.org/x/sync/semaphore
|
||||||
# golang.org/x/sys v0.35.0
|
# golang.org/x/sys v0.36.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/sys/plan9
|
golang.org/x/sys/plan9
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
golang.org/x/sys/windows
|
golang.org/x/sys/windows
|
||||||
# golang.org/x/telemetry v0.0.0-20250807160809-1a19826ec488
|
# golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/telemetry
|
golang.org/x/telemetry
|
||||||
golang.org/x/telemetry/counter
|
golang.org/x/telemetry/counter
|
||||||
golang.org/x/telemetry/counter/countertest
|
golang.org/x/telemetry/counter/countertest
|
||||||
|
|
@ -63,8 +63,8 @@ golang.org/x/telemetry/internal/upload
|
||||||
# golang.org/x/term v0.34.0
|
# golang.org/x/term v0.34.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.23.0
|
||||||
golang.org/x/term
|
golang.org/x/term
|
||||||
# golang.org/x/text v0.28.0
|
# golang.org/x/text v0.29.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/text/cases
|
golang.org/x/text/cases
|
||||||
golang.org/x/text/internal
|
golang.org/x/text/internal
|
||||||
golang.org/x/text/internal/language
|
golang.org/x/text/internal/language
|
||||||
|
|
@ -73,7 +73,7 @@ golang.org/x/text/internal/tag
|
||||||
golang.org/x/text/language
|
golang.org/x/text/language
|
||||||
golang.org/x/text/transform
|
golang.org/x/text/transform
|
||||||
golang.org/x/text/unicode/norm
|
golang.org/x/text/unicode/norm
|
||||||
# golang.org/x/tools v0.36.1-0.20250904192731-a09a2fba1c08
|
# golang.org/x/tools v0.37.1-0.20250911182313-3adf0e96d87d
|
||||||
## explicit; go 1.24.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/tools/cmd/bisect
|
golang.org/x/tools/cmd/bisect
|
||||||
golang.org/x/tools/cover
|
golang.org/x/tools/cover
|
||||||
|
|
@ -132,6 +132,7 @@ golang.org/x/tools/internal/diff
|
||||||
golang.org/x/tools/internal/diff/lcs
|
golang.org/x/tools/internal/diff/lcs
|
||||||
golang.org/x/tools/internal/facts
|
golang.org/x/tools/internal/facts
|
||||||
golang.org/x/tools/internal/fmtstr
|
golang.org/x/tools/internal/fmtstr
|
||||||
|
golang.org/x/tools/internal/moreiters
|
||||||
golang.org/x/tools/internal/stdlib
|
golang.org/x/tools/internal/stdlib
|
||||||
golang.org/x/tools/internal/typeparams
|
golang.org/x/tools/internal/typeparams
|
||||||
golang.org/x/tools/internal/typesinternal
|
golang.org/x/tools/internal/typesinternal
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,11 @@ module std
|
||||||
go 1.26
|
go 1.26
|
||||||
|
|
||||||
require (
|
require (
|
||||||
golang.org/x/crypto v0.41.0
|
golang.org/x/crypto v0.42.0
|
||||||
golang.org/x/net v0.43.0
|
golang.org/x/net v0.44.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
golang.org/x/sys v0.35.0 // indirect
|
golang.org/x/sys v0.36.0 // indirect
|
||||||
golang.org/x/text v0.28.0 // indirect
|
golang.org/x/text v0.29.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
|
||||||
16
src/go.sum
16
src/go.sum
|
|
@ -1,8 +1,8 @@
|
||||||
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
|
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
||||||
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
|
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
||||||
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
||||||
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
||||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ var permitted = [][]byte{
|
||||||
[]byte("// mkerrors"),
|
[]byte("// mkerrors"),
|
||||||
[]byte("// mksys"),
|
[]byte("// mksys"),
|
||||||
[]byte("// run\n// Code generated by"), // cmd/compile/internal/test/constFold_test.go
|
[]byte("// run\n// Code generated by"), // cmd/compile/internal/test/constFold_test.go
|
||||||
|
[]byte("//go:build !nethttpomithttp2"), // hack to pacify h2_bundle, which drops copyright header
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCopyright(t *testing.T) {
|
func TestCopyright(t *testing.T) {
|
||||||
|
|
@ -64,6 +65,7 @@ func TestCopyright(t *testing.T) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
t.Logf("%.100s %s", b, path)
|
||||||
t.Errorf("%s: missing copyright notice", path)
|
t.Errorf("%s: missing copyright notice", path)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) {
|
func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) {
|
||||||
r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition)))
|
r0, _, _ := syscall.SyscallN(procRegCreateKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
regerrno = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +58,7 @@ func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *
|
||||||
}
|
}
|
||||||
|
|
||||||
func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) {
|
func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) {
|
||||||
r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0)
|
r0, _, _ := syscall.SyscallN(procRegDeleteKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
regerrno = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +66,7 @@ func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) {
|
func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) {
|
||||||
r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0)
|
r0, _, _ := syscall.SyscallN(procRegDeleteValueW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
regerrno = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +74,7 @@ func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
|
func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) {
|
||||||
r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0)
|
r0, _, _ := syscall.SyscallN(procRegEnumValueW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
regerrno = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint3
|
||||||
}
|
}
|
||||||
|
|
||||||
func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) {
|
func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) {
|
||||||
r0, _, _ := syscall.Syscall9(procRegLoadMUIStringW.Addr(), 7, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir)), 0, 0)
|
r0, _, _ := syscall.SyscallN(procRegLoadMUIStringW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
regerrno = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint
|
||||||
}
|
}
|
||||||
|
|
||||||
func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) {
|
func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) {
|
||||||
r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize))
|
r0, _, _ := syscall.SyscallN(procRegSetValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
regerrno = syscall.Errno(r0)
|
regerrno = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -98,7 +98,7 @@ func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype
|
||||||
}
|
}
|
||||||
|
|
||||||
func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) {
|
func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size))
|
r0, _, e1 := syscall.SyscallN(procExpandEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size))
|
||||||
n = uint32(r0)
|
n = uint32(r0)
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ func adjustTokenPrivileges(token syscall.Token, disableAllPrivileges bool, newst
|
||||||
if disableAllPrivileges {
|
if disableAllPrivileges {
|
||||||
_p0 = 1
|
_p0 = 1
|
||||||
}
|
}
|
||||||
r0, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
|
r0, _, e1 := syscall.SyscallN(procAdjustTokenPrivileges.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen)))
|
||||||
ret = uint32(r0)
|
ret = uint32(r0)
|
||||||
if true {
|
if true {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -125,7 +125,7 @@ func adjustTokenPrivileges(token syscall.Token, disableAllPrivileges bool, newst
|
||||||
}
|
}
|
||||||
|
|
||||||
func DuplicateTokenEx(hExistingToken syscall.Token, dwDesiredAccess uint32, lpTokenAttributes *syscall.SecurityAttributes, impersonationLevel uint32, tokenType TokenType, phNewToken *syscall.Token) (err error) {
|
func DuplicateTokenEx(hExistingToken syscall.Token, dwDesiredAccess uint32, lpTokenAttributes *syscall.SecurityAttributes, impersonationLevel uint32, tokenType TokenType, phNewToken *syscall.Token) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(hExistingToken), uintptr(dwDesiredAccess), uintptr(unsafe.Pointer(lpTokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(phNewToken)))
|
r1, _, e1 := syscall.SyscallN(procDuplicateTokenEx.Addr(), uintptr(hExistingToken), uintptr(dwDesiredAccess), uintptr(unsafe.Pointer(lpTokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(phNewToken)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -133,25 +133,25 @@ func DuplicateTokenEx(hExistingToken syscall.Token, dwDesiredAccess uint32, lpTo
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSidIdentifierAuthority(sid *syscall.SID) (idauth uintptr) {
|
func getSidIdentifierAuthority(sid *syscall.SID) (idauth uintptr) {
|
||||||
r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
r0, _, _ := syscall.SyscallN(procGetSidIdentifierAuthority.Addr(), uintptr(unsafe.Pointer(sid)))
|
||||||
idauth = uintptr(r0)
|
idauth = uintptr(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSidSubAuthority(sid *syscall.SID, subAuthorityIdx uint32) (subAuth uintptr) {
|
func getSidSubAuthority(sid *syscall.SID, subAuthorityIdx uint32) (subAuth uintptr) {
|
||||||
r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(subAuthorityIdx), 0)
|
r0, _, _ := syscall.SyscallN(procGetSidSubAuthority.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(subAuthorityIdx))
|
||||||
subAuth = uintptr(r0)
|
subAuth = uintptr(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSidSubAuthorityCount(sid *syscall.SID) (count uintptr) {
|
func getSidSubAuthorityCount(sid *syscall.SID) (count uintptr) {
|
||||||
r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
r0, _, _ := syscall.SyscallN(procGetSidSubAuthorityCount.Addr(), uintptr(unsafe.Pointer(sid)))
|
||||||
count = uintptr(r0)
|
count = uintptr(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func ImpersonateLoggedOnUser(token syscall.Token) (err error) {
|
func ImpersonateLoggedOnUser(token syscall.Token) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procImpersonateLoggedOnUser.Addr(), 1, uintptr(token), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procImpersonateLoggedOnUser.Addr(), uintptr(token))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -159,7 +159,7 @@ func ImpersonateLoggedOnUser(token syscall.Token) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ImpersonateSelf(impersonationlevel uint32) (err error) {
|
func ImpersonateSelf(impersonationlevel uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procImpersonateSelf.Addr(), uintptr(impersonationlevel))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -167,13 +167,13 @@ func ImpersonateSelf(impersonationlevel uint32) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsValidSid(sid *syscall.SID) (valid bool) {
|
func IsValidSid(sid *syscall.SID) (valid bool) {
|
||||||
r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0)
|
r0, _, _ := syscall.SyscallN(procIsValidSid.Addr(), uintptr(unsafe.Pointer(sid)))
|
||||||
valid = r0 != 0
|
valid = r0 != 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func LogonUser(username *uint16, domain *uint16, password *uint16, logonType uint32, logonProvider uint32, token *syscall.Token) (err error) {
|
func LogonUser(username *uint16, domain *uint16, password *uint16, logonType uint32, logonProvider uint32, token *syscall.Token) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procLogonUserW.Addr(), 6, uintptr(unsafe.Pointer(username)), uintptr(unsafe.Pointer(domain)), uintptr(unsafe.Pointer(password)), uintptr(logonType), uintptr(logonProvider), uintptr(unsafe.Pointer(token)))
|
r1, _, e1 := syscall.SyscallN(procLogonUserW.Addr(), uintptr(unsafe.Pointer(username)), uintptr(unsafe.Pointer(domain)), uintptr(unsafe.Pointer(password)), uintptr(logonType), uintptr(logonProvider), uintptr(unsafe.Pointer(token)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +181,7 @@ func LogonUser(username *uint16, domain *uint16, password *uint16, logonType uin
|
||||||
}
|
}
|
||||||
|
|
||||||
func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
|
func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
|
r1, _, e1 := syscall.SyscallN(procLookupPrivilegeValueW.Addr(), uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +189,7 @@ func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err err
|
||||||
}
|
}
|
||||||
|
|
||||||
func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle syscall.Handle, err error) {
|
func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
|
r0, _, e1 := syscall.SyscallN(procOpenSCManagerW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access))
|
||||||
handle = syscall.Handle(r0)
|
handle = syscall.Handle(r0)
|
||||||
if handle == 0 {
|
if handle == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -198,7 +198,7 @@ func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (ha
|
||||||
}
|
}
|
||||||
|
|
||||||
func OpenService(mgr syscall.Handle, serviceName *uint16, access uint32) (handle syscall.Handle, err error) {
|
func OpenService(mgr syscall.Handle, serviceName *uint16, access uint32) (handle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
|
r0, _, e1 := syscall.SyscallN(procOpenServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access))
|
||||||
handle = syscall.Handle(r0)
|
handle = syscall.Handle(r0)
|
||||||
if handle == 0 {
|
if handle == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -211,7 +211,7 @@ func OpenThreadToken(h syscall.Handle, access uint32, openasself bool, token *sy
|
||||||
if openasself {
|
if openasself {
|
||||||
_p0 = 1
|
_p0 = 1
|
||||||
}
|
}
|
||||||
r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(h), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procOpenThreadToken.Addr(), uintptr(h), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ func OpenThreadToken(h syscall.Handle, access uint32, openasself bool, token *sy
|
||||||
}
|
}
|
||||||
|
|
||||||
func QueryServiceStatus(hService syscall.Handle, lpServiceStatus *SERVICE_STATUS) (err error) {
|
func QueryServiceStatus(hService syscall.Handle, lpServiceStatus *SERVICE_STATUS) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(hService), uintptr(unsafe.Pointer(lpServiceStatus)), 0)
|
r1, _, e1 := syscall.SyscallN(procQueryServiceStatus.Addr(), uintptr(hService), uintptr(unsafe.Pointer(lpServiceStatus)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +227,7 @@ func QueryServiceStatus(hService syscall.Handle, lpServiceStatus *SERVICE_STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
func RevertToSelf() (err error) {
|
func RevertToSelf() (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0)
|
r1, _, e1 := syscall.SyscallN(procRevertToSelf.Addr())
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -235,7 +235,7 @@ func RevertToSelf() (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetTokenInformation(tokenHandle syscall.Token, tokenInformationClass uint32, tokenInformation unsafe.Pointer, tokenInformationLength uint32) (err error) {
|
func SetTokenInformation(tokenHandle syscall.Token, tokenInformationClass uint32, tokenInformation unsafe.Pointer, tokenInformationLength uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(tokenHandle), uintptr(tokenInformationClass), uintptr(tokenInformation), uintptr(tokenInformationLength), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procSetTokenInformation.Addr(), uintptr(tokenHandle), uintptr(tokenInformationClass), uintptr(tokenInformation), uintptr(tokenInformationLength))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +247,7 @@ func ProcessPrng(buf []byte) (err error) {
|
||||||
if len(buf) > 0 {
|
if len(buf) > 0 {
|
||||||
_p0 = &buf[0]
|
_p0 = &buf[0]
|
||||||
}
|
}
|
||||||
r1, _, e1 := syscall.Syscall(procProcessPrng.Addr(), 2, uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), 0)
|
r1, _, e1 := syscall.SyscallN(procProcessPrng.Addr(), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +255,7 @@ func ProcessPrng(buf []byte) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetAdaptersAddresses(family uint32, flags uint32, reserved unsafe.Pointer, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
func GetAdaptersAddresses(family uint32, flags uint32, reserved unsafe.Pointer, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) {
|
||||||
r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0)
|
r0, _, _ := syscall.SyscallN(procGetAdaptersAddresses.Addr(), uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
errcode = syscall.Errno(r0)
|
errcode = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -263,7 +263,7 @@ func GetAdaptersAddresses(family uint32, flags uint32, reserved unsafe.Pointer,
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle syscall.Handle, err error) {
|
func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0)
|
r0, _, e1 := syscall.SyscallN(procCreateEventW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)))
|
||||||
handle = syscall.Handle(r0)
|
handle = syscall.Handle(r0)
|
||||||
if handle == 0 {
|
if handle == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -272,7 +272,7 @@ func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialStat
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateIoCompletionPort(filehandle syscall.Handle, cphandle syscall.Handle, key uintptr, threadcnt uint32) (handle syscall.Handle, err error) {
|
func CreateIoCompletionPort(filehandle syscall.Handle, cphandle syscall.Handle, key uintptr, threadcnt uint32) (handle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
|
r0, _, e1 := syscall.SyscallN(procCreateIoCompletionPort.Addr(), uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt))
|
||||||
handle = syscall.Handle(r0)
|
handle = syscall.Handle(r0)
|
||||||
if handle == 0 {
|
if handle == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -281,7 +281,7 @@ func CreateIoCompletionPort(filehandle syscall.Handle, cphandle syscall.Handle,
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) {
|
func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *syscall.SecurityAttributes) (handle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0)
|
r0, _, e1 := syscall.SyscallN(procCreateNamedPipeW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)))
|
||||||
handle = syscall.Handle(r0)
|
handle = syscall.Handle(r0)
|
||||||
if handle == syscall.InvalidHandle {
|
if handle == syscall.InvalidHandle {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -290,13 +290,13 @@ func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances u
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetACP() (acp uint32) {
|
func GetACP() (acp uint32) {
|
||||||
r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0)
|
r0, _, _ := syscall.SyscallN(procGetACP.Addr())
|
||||||
acp = uint32(r0)
|
acp = uint32(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) {
|
func GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nameformat), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
|
r1, _, e1 := syscall.SyscallN(procGetComputerNameExW.Addr(), uintptr(nameformat), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -304,13 +304,13 @@ func GetComputerNameEx(nameformat uint32, buf *uint16, n *uint32) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetConsoleCP() (ccp uint32) {
|
func GetConsoleCP() (ccp uint32) {
|
||||||
r0, _, _ := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0)
|
r0, _, _ := syscall.SyscallN(procGetConsoleCP.Addr())
|
||||||
ccp = uint32(r0)
|
ccp = uint32(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetCurrentThread() (pseudoHandle syscall.Handle, err error) {
|
func GetCurrentThread() (pseudoHandle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procGetCurrentThread.Addr(), 0, 0, 0, 0)
|
r0, _, e1 := syscall.SyscallN(procGetCurrentThread.Addr())
|
||||||
pseudoHandle = syscall.Handle(r0)
|
pseudoHandle = syscall.Handle(r0)
|
||||||
if pseudoHandle == 0 {
|
if pseudoHandle == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -319,7 +319,7 @@ func GetCurrentThread() (pseudoHandle syscall.Handle, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFileInformationByHandleEx(handle syscall.Handle, class uint32, info *byte, bufsize uint32) (err error) {
|
func GetFileInformationByHandleEx(handle syscall.Handle, class uint32, info *byte, bufsize uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(info)), uintptr(bufsize), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandleEx.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(info)), uintptr(bufsize))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -327,7 +327,7 @@ func GetFileInformationByHandleEx(handle syscall.Handle, class uint32, info *byt
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFinalPathNameByHandle(file syscall.Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
|
func GetFinalPathNameByHandle(file syscall.Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) {
|
||||||
r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0)
|
r0, _, e1 := syscall.SyscallN(procGetFinalPathNameByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags))
|
||||||
n = uint32(r0)
|
n = uint32(r0)
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -336,7 +336,7 @@ func GetFinalPathNameByHandle(file syscall.Handle, filePath *uint16, filePathSiz
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetModuleFileName(module syscall.Handle, fn *uint16, len uint32) (n uint32, err error) {
|
func GetModuleFileName(module syscall.Handle, fn *uint16, len uint32) (n uint32, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(fn)), uintptr(len))
|
r0, _, e1 := syscall.SyscallN(procGetModuleFileNameW.Addr(), uintptr(module), uintptr(unsafe.Pointer(fn)), uintptr(len))
|
||||||
n = uint32(r0)
|
n = uint32(r0)
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -345,7 +345,7 @@ func GetModuleFileName(module syscall.Handle, fn *uint16, len uint32) (n uint32,
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetModuleHandle(modulename *uint16) (handle syscall.Handle, err error) {
|
func GetModuleHandle(modulename *uint16) (handle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procGetModuleHandleW.Addr(), 1, uintptr(unsafe.Pointer(modulename)), 0, 0)
|
r0, _, e1 := syscall.SyscallN(procGetModuleHandleW.Addr(), uintptr(unsafe.Pointer(modulename)))
|
||||||
handle = syscall.Handle(r0)
|
handle = syscall.Handle(r0)
|
||||||
if handle == 0 {
|
if handle == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -358,7 +358,7 @@ func GetOverlappedResult(handle syscall.Handle, overlapped *syscall.Overlapped,
|
||||||
if wait {
|
if wait {
|
||||||
_p0 = 1
|
_p0 = 1
|
||||||
}
|
}
|
||||||
r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procGetOverlappedResult.Addr(), uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -366,7 +366,7 @@ func GetOverlappedResult(handle syscall.Handle, overlapped *syscall.Overlapped,
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTempPath2(buflen uint32, buf *uint16) (n uint32, err error) {
|
func GetTempPath2(buflen uint32, buf *uint16) (n uint32, err error) {
|
||||||
r0, _, e1 := syscall.Syscall(procGetTempPath2W.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0)
|
r0, _, e1 := syscall.SyscallN(procGetTempPath2W.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf)))
|
||||||
n = uint32(r0)
|
n = uint32(r0)
|
||||||
if n == 0 {
|
if n == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -375,7 +375,7 @@ func GetTempPath2(buflen uint32, buf *uint16) (n uint32, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVolumeInformationByHandle(file syscall.Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
|
func GetVolumeInformationByHandle(file syscall.Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0)
|
r1, _, e1 := syscall.SyscallN(procGetVolumeInformationByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -383,7 +383,7 @@ func GetVolumeInformationByHandle(file syscall.Handle, volumeNameBuffer *uint16,
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
|
func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
|
r1, _, e1 := syscall.SyscallN(procGetVolumeNameForVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -391,7 +391,7 @@ func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint
|
||||||
}
|
}
|
||||||
|
|
||||||
func LockFileEx(file syscall.Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) {
|
func LockFileEx(file syscall.Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
|
r1, _, e1 := syscall.SyscallN(procLockFileEx.Addr(), uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -399,7 +399,7 @@ func LockFileEx(file syscall.Handle, flags uint32, reserved uint32, bytesLow uin
|
||||||
}
|
}
|
||||||
|
|
||||||
func Module32First(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) {
|
func Module32First(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
|
r1, _, e1 := syscall.SyscallN(procModule32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +407,7 @@ func Module32First(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err err
|
||||||
}
|
}
|
||||||
|
|
||||||
func Module32Next(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) {
|
func Module32Next(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0)
|
r1, _, e1 := syscall.SyscallN(procModule32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -415,7 +415,7 @@ func Module32Next(snapshot syscall.Handle, moduleEntry *ModuleEntry32) (err erro
|
||||||
}
|
}
|
||||||
|
|
||||||
func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
|
func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
|
r1, _, e1 := syscall.SyscallN(procMoveFileExW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -423,7 +423,7 @@ func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
|
func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) {
|
||||||
r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
|
r0, _, e1 := syscall.SyscallN(procMultiByteToWideChar.Addr(), uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar))
|
||||||
nwrite = int32(r0)
|
nwrite = int32(r0)
|
||||||
if nwrite == 0 {
|
if nwrite == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
@ -432,19 +432,19 @@ func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32,
|
||||||
}
|
}
|
||||||
|
|
||||||
func RtlLookupFunctionEntry(pc uintptr, baseAddress *uintptr, table unsafe.Pointer) (ret *RUNTIME_FUNCTION) {
|
func RtlLookupFunctionEntry(pc uintptr, baseAddress *uintptr, table unsafe.Pointer) (ret *RUNTIME_FUNCTION) {
|
||||||
r0, _, _ := syscall.Syscall(procRtlLookupFunctionEntry.Addr(), 3, uintptr(pc), uintptr(unsafe.Pointer(baseAddress)), uintptr(table))
|
r0, _, _ := syscall.SyscallN(procRtlLookupFunctionEntry.Addr(), uintptr(pc), uintptr(unsafe.Pointer(baseAddress)), uintptr(table))
|
||||||
ret = (*RUNTIME_FUNCTION)(unsafe.Pointer(r0))
|
ret = (*RUNTIME_FUNCTION)(unsafe.Pointer(r0))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func RtlVirtualUnwind(handlerType uint32, baseAddress uintptr, pc uintptr, entry *RUNTIME_FUNCTION, ctxt unsafe.Pointer, data unsafe.Pointer, frame *uintptr, ctxptrs unsafe.Pointer) (ret uintptr) {
|
func RtlVirtualUnwind(handlerType uint32, baseAddress uintptr, pc uintptr, entry *RUNTIME_FUNCTION, ctxt unsafe.Pointer, data unsafe.Pointer, frame *uintptr, ctxptrs unsafe.Pointer) (ret uintptr) {
|
||||||
r0, _, _ := syscall.Syscall9(procRtlVirtualUnwind.Addr(), 8, uintptr(handlerType), uintptr(baseAddress), uintptr(pc), uintptr(unsafe.Pointer(entry)), uintptr(ctxt), uintptr(data), uintptr(unsafe.Pointer(frame)), uintptr(ctxptrs), 0)
|
r0, _, _ := syscall.SyscallN(procRtlVirtualUnwind.Addr(), uintptr(handlerType), uintptr(baseAddress), uintptr(pc), uintptr(unsafe.Pointer(entry)), uintptr(ctxt), uintptr(data), uintptr(unsafe.Pointer(frame)), uintptr(ctxptrs))
|
||||||
ret = uintptr(r0)
|
ret = uintptr(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetFileInformationByHandle(handle syscall.Handle, fileInformationClass uint32, buf unsafe.Pointer, bufsize uint32) (err error) {
|
func SetFileInformationByHandle(handle syscall.Handle, fileInformationClass uint32, buf unsafe.Pointer, bufsize uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(fileInformationClass), uintptr(buf), uintptr(bufsize), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procSetFileInformationByHandle.Addr(), uintptr(handle), uintptr(fileInformationClass), uintptr(buf), uintptr(bufsize))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -452,7 +452,7 @@ func SetFileInformationByHandle(handle syscall.Handle, fileInformationClass uint
|
||||||
}
|
}
|
||||||
|
|
||||||
func UnlockFileEx(file syscall.Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) {
|
func UnlockFileEx(file syscall.Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *syscall.Overlapped) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0)
|
r1, _, e1 := syscall.SyscallN(procUnlockFileEx.Addr(), uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -460,7 +460,7 @@ func UnlockFileEx(file syscall.Handle, reserved uint32, bytesLow uint32, bytesHi
|
||||||
}
|
}
|
||||||
|
|
||||||
func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
|
func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length))
|
r1, _, e1 := syscall.SyscallN(procVirtualQuery.Addr(), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -468,7 +468,7 @@ func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintpt
|
||||||
}
|
}
|
||||||
|
|
||||||
func NetShareAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint16) (neterr error) {
|
func NetShareAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint16) (neterr error) {
|
||||||
r0, _, _ := syscall.Syscall6(procNetShareAdd.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr)), 0, 0)
|
r0, _, _ := syscall.SyscallN(procNetShareAdd.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
neterr = syscall.Errno(r0)
|
neterr = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -476,7 +476,7 @@ func NetShareAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint16) (
|
||||||
}
|
}
|
||||||
|
|
||||||
func NetShareDel(serverName *uint16, netName *uint16, reserved uint32) (neterr error) {
|
func NetShareDel(serverName *uint16, netName *uint16, reserved uint32) (neterr error) {
|
||||||
r0, _, _ := syscall.Syscall(procNetShareDel.Addr(), 3, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(netName)), uintptr(reserved))
|
r0, _, _ := syscall.SyscallN(procNetShareDel.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(netName)), uintptr(reserved))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
neterr = syscall.Errno(r0)
|
neterr = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -484,7 +484,7 @@ func NetShareDel(serverName *uint16, netName *uint16, reserved uint32) (neterr e
|
||||||
}
|
}
|
||||||
|
|
||||||
func NetUserAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint32) (neterr error) {
|
func NetUserAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint32) (neterr error) {
|
||||||
r0, _, _ := syscall.Syscall6(procNetUserAdd.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr)), 0, 0)
|
r0, _, _ := syscall.SyscallN(procNetUserAdd.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(parmErr)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
neterr = syscall.Errno(r0)
|
neterr = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -492,7 +492,7 @@ func NetUserAdd(serverName *uint16, level uint32, buf *byte, parmErr *uint32) (n
|
||||||
}
|
}
|
||||||
|
|
||||||
func NetUserDel(serverName *uint16, userName *uint16) (neterr error) {
|
func NetUserDel(serverName *uint16, userName *uint16) (neterr error) {
|
||||||
r0, _, _ := syscall.Syscall(procNetUserDel.Addr(), 2, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), 0)
|
r0, _, _ := syscall.SyscallN(procNetUserDel.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
neterr = syscall.Errno(r0)
|
neterr = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -500,7 +500,7 @@ func NetUserDel(serverName *uint16, userName *uint16) (neterr error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NetUserGetLocalGroups(serverName *uint16, userName *uint16, level uint32, flags uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32) (neterr error) {
|
func NetUserGetLocalGroups(serverName *uint16, userName *uint16, level uint32, flags uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32) (neterr error) {
|
||||||
r0, _, _ := syscall.Syscall9(procNetUserGetLocalGroups.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(flags), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), 0)
|
r0, _, _ := syscall.SyscallN(procNetUserGetLocalGroups.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(flags), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
neterr = syscall.Errno(r0)
|
neterr = syscall.Errno(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -508,7 +508,7 @@ func NetUserGetLocalGroups(serverName *uint16, userName *uint16, level uint32, f
|
||||||
}
|
}
|
||||||
|
|
||||||
func NtCreateFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer unsafe.Pointer, ealength uint32) (ntstatus error) {
|
func NtCreateFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer unsafe.Pointer, ealength uint32) (ntstatus error) {
|
||||||
r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0)
|
r0, _, _ := syscall.SyscallN(procNtCreateFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
ntstatus = NTStatus(r0)
|
ntstatus = NTStatus(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -516,7 +516,7 @@ func NtCreateFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES,
|
||||||
}
|
}
|
||||||
|
|
||||||
func NtOpenFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, options uint32) (ntstatus error) {
|
func NtOpenFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, options uint32) (ntstatus error) {
|
||||||
r0, _, _ := syscall.Syscall6(procNtOpenFile.Addr(), 6, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(options))
|
r0, _, _ := syscall.SyscallN(procNtOpenFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(options))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
ntstatus = NTStatus(r0)
|
ntstatus = NTStatus(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -524,7 +524,7 @@ func NtOpenFile(handle *syscall.Handle, access uint32, oa *OBJECT_ATTRIBUTES, io
|
||||||
}
|
}
|
||||||
|
|
||||||
func NtQueryInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) {
|
func NtQueryInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) {
|
||||||
r0, _, _ := syscall.Syscall6(procNtQueryInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class), 0)
|
r0, _, _ := syscall.SyscallN(procNtQueryInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
ntstatus = NTStatus(r0)
|
ntstatus = NTStatus(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -532,7 +532,7 @@ func NtQueryInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuff
|
||||||
}
|
}
|
||||||
|
|
||||||
func NtSetInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) {
|
func NtSetInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) {
|
||||||
r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class), 0)
|
r0, _, _ := syscall.SyscallN(procNtSetInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(inBuffer), uintptr(inBufferLen), uintptr(class))
|
||||||
if r0 != 0 {
|
if r0 != 0 {
|
||||||
ntstatus = NTStatus(r0)
|
ntstatus = NTStatus(r0)
|
||||||
}
|
}
|
||||||
|
|
@ -540,24 +540,24 @@ func NtSetInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer
|
||||||
}
|
}
|
||||||
|
|
||||||
func rtlGetVersion(info *_OSVERSIONINFOEXW) {
|
func rtlGetVersion(info *_OSVERSIONINFOEXW) {
|
||||||
syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0)
|
syscall.SyscallN(procRtlGetVersion.Addr(), uintptr(unsafe.Pointer(info)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func RtlIsDosDeviceName_U(name *uint16) (ret uint32) {
|
func RtlIsDosDeviceName_U(name *uint16) (ret uint32) {
|
||||||
r0, _, _ := syscall.Syscall(procRtlIsDosDeviceName_U.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0)
|
r0, _, _ := syscall.SyscallN(procRtlIsDosDeviceName_U.Addr(), uintptr(unsafe.Pointer(name)))
|
||||||
ret = uint32(r0)
|
ret = uint32(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) {
|
func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) {
|
||||||
r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0)
|
r0, _, _ := syscall.SyscallN(procRtlNtStatusToDosErrorNoTeb.Addr(), uintptr(ntstatus))
|
||||||
ret = syscall.Errno(r0)
|
ret = syscall.Errno(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetProcessMemoryInfo(handle syscall.Handle, memCounters *PROCESS_MEMORY_COUNTERS, cb uint32) (err error) {
|
func GetProcessMemoryInfo(handle syscall.Handle, memCounters *PROCESS_MEMORY_COUNTERS, cb uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procGetProcessMemoryInfo.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(memCounters)), uintptr(cb))
|
r1, _, e1 := syscall.SyscallN(procGetProcessMemoryInfo.Addr(), uintptr(handle), uintptr(unsafe.Pointer(memCounters)), uintptr(cb))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -569,7 +569,7 @@ func CreateEnvironmentBlock(block **uint16, token syscall.Token, inheritExisting
|
||||||
if inheritExisting {
|
if inheritExisting {
|
||||||
_p0 = 1
|
_p0 = 1
|
||||||
}
|
}
|
||||||
r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
|
r1, _, e1 := syscall.SyscallN(procCreateEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -577,7 +577,7 @@ func CreateEnvironmentBlock(block **uint16, token syscall.Token, inheritExisting
|
||||||
}
|
}
|
||||||
|
|
||||||
func DestroyEnvironmentBlock(block *uint16) (err error) {
|
func DestroyEnvironmentBlock(block *uint16) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0)
|
r1, _, e1 := syscall.SyscallN(procDestroyEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -585,7 +585,7 @@ func DestroyEnvironmentBlock(block *uint16) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetProfilesDirectory(dir *uint16, dirLen *uint32) (err error) {
|
func GetProfilesDirectory(dir *uint16, dirLen *uint32) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procGetProfilesDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)), 0)
|
r1, _, e1 := syscall.SyscallN(procGetProfilesDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -593,7 +593,7 @@ func GetProfilesDirectory(dir *uint16, dirLen *uint32) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func WSADuplicateSocket(s syscall.Handle, processID uint32, info *syscall.WSAProtocolInfo) (err error) {
|
func WSADuplicateSocket(s syscall.Handle, processID uint32, info *syscall.WSAProtocolInfo) (err error) {
|
||||||
r1, _, e1 := syscall.Syscall(procWSADuplicateSocketW.Addr(), 3, uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info)))
|
r1, _, e1 := syscall.SyscallN(procWSADuplicateSocketW.Addr(), uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info)))
|
||||||
if r1 != 0 {
|
if r1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -605,7 +605,7 @@ func WSAGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint
|
||||||
if wait {
|
if wait {
|
||||||
_p0 = 1
|
_p0 = 1
|
||||||
}
|
}
|
||||||
r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0)
|
r1, _, e1 := syscall.SyscallN(procWSAGetOverlappedResult.Addr(), uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)))
|
||||||
if r1 == 0 {
|
if r1 == 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
|
@ -613,7 +613,7 @@ func WSAGetOverlappedResult(h syscall.Handle, o *syscall.Overlapped, bytes *uint
|
||||||
}
|
}
|
||||||
|
|
||||||
func WSASocket(af int32, typ int32, protocol int32, protinfo *syscall.WSAProtocolInfo, group uint32, flags uint32) (handle syscall.Handle, err error) {
|
func WSASocket(af int32, typ int32, protocol int32, protinfo *syscall.WSAProtocolInfo, group uint32, flags uint32) (handle syscall.Handle, err error) {
|
||||||
r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protinfo)), uintptr(group), uintptr(flags))
|
r0, _, e1 := syscall.SyscallN(procWSASocketW.Addr(), uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protinfo)), uintptr(group), uintptr(flags))
|
||||||
handle = syscall.Handle(r0)
|
handle = syscall.Handle(r0)
|
||||||
if handle == syscall.InvalidHandle {
|
if handle == syscall.InvalidHandle {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,6 @@
|
||||||
//
|
//
|
||||||
// See https://http2.github.io/ for more information on HTTP/2.
|
// See https://http2.github.io/ for more information on HTTP/2.
|
||||||
//
|
//
|
||||||
// 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 http
|
package http
|
||||||
|
|
||||||
|
|
@ -1079,7 +1075,7 @@ func http2configFromServer(h1 *Server, h2 *http2Server) http2http2Config {
|
||||||
PermitProhibitedCipherSuites: h2.PermitProhibitedCipherSuites,
|
PermitProhibitedCipherSuites: h2.PermitProhibitedCipherSuites,
|
||||||
CountError: h2.CountError,
|
CountError: h2.CountError,
|
||||||
}
|
}
|
||||||
http2fillNetHTTPServerConfig(&conf, h1)
|
http2fillNetHTTPConfig(&conf, h1.HTTP2)
|
||||||
http2setConfigDefaults(&conf, true)
|
http2setConfigDefaults(&conf, true)
|
||||||
return conf
|
return conf
|
||||||
}
|
}
|
||||||
|
|
@ -1105,7 +1101,7 @@ func http2configFromTransport(h2 *http2Transport) http2http2Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
if h2.t1 != nil {
|
if h2.t1 != nil {
|
||||||
http2fillNetHTTPTransportConfig(&conf, h2.t1)
|
http2fillNetHTTPConfig(&conf, h2.t1.HTTP2)
|
||||||
}
|
}
|
||||||
http2setConfigDefaults(&conf, false)
|
http2setConfigDefaults(&conf, false)
|
||||||
return conf
|
return conf
|
||||||
|
|
@ -1145,16 +1141,6 @@ func http2adjustHTTP1MaxHeaderSize(n int64) int64 {
|
||||||
return n + typicalHeaders*perFieldOverhead
|
return n + typicalHeaders*perFieldOverhead
|
||||||
}
|
}
|
||||||
|
|
||||||
// fillNetHTTPServerConfig sets fields in conf from srv.HTTP2.
|
|
||||||
func http2fillNetHTTPServerConfig(conf *http2http2Config, srv *Server) {
|
|
||||||
http2fillNetHTTPConfig(conf, srv.HTTP2)
|
|
||||||
}
|
|
||||||
|
|
||||||
// fillNetHTTPTransportConfig sets fields in conf from tr.HTTP2.
|
|
||||||
func http2fillNetHTTPTransportConfig(conf *http2http2Config, tr *Transport) {
|
|
||||||
http2fillNetHTTPConfig(conf, tr.HTTP2)
|
|
||||||
}
|
|
||||||
|
|
||||||
func http2fillNetHTTPConfig(conf *http2http2Config, h2 *HTTP2Config) {
|
func http2fillNetHTTPConfig(conf *http2http2Config, h2 *HTTP2Config) {
|
||||||
if h2 == nil {
|
if h2 == nil {
|
||||||
return
|
return
|
||||||
|
|
@ -3273,17 +3259,27 @@ func http2summarizeFrame(f http2Frame) string {
|
||||||
|
|
||||||
var http2DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1"
|
var http2DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1"
|
||||||
|
|
||||||
|
// Setting DebugGoroutines to false during a test to disable goroutine debugging
|
||||||
|
// results in race detector complaints when a test leaves goroutines running before
|
||||||
|
// returning. Tests shouldn't do this, of course, but when they do it generally shows
|
||||||
|
// up as infrequent, hard-to-debug flakes. (See #66519.)
|
||||||
|
//
|
||||||
|
// Disable goroutine debugging during individual tests with an atomic bool.
|
||||||
|
// (Note that it's safe to enable/disable debugging mid-test, so the actual race condition
|
||||||
|
// here is harmless.)
|
||||||
|
var http2disableDebugGoroutines atomic.Bool
|
||||||
|
|
||||||
type http2goroutineLock uint64
|
type http2goroutineLock uint64
|
||||||
|
|
||||||
func http2newGoroutineLock() http2goroutineLock {
|
func http2newGoroutineLock() http2goroutineLock {
|
||||||
if !http2DebugGoroutines {
|
if !http2DebugGoroutines || http2disableDebugGoroutines.Load() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return http2goroutineLock(http2curGoroutineID())
|
return http2goroutineLock(http2curGoroutineID())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g http2goroutineLock) check() {
|
func (g http2goroutineLock) check() {
|
||||||
if !http2DebugGoroutines {
|
if !http2DebugGoroutines || http2disableDebugGoroutines.Load() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if http2curGoroutineID() != uint64(g) {
|
if http2curGoroutineID() != uint64(g) {
|
||||||
|
|
@ -3292,7 +3288,7 @@ func (g http2goroutineLock) check() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g http2goroutineLock) checkNotOn() {
|
func (g http2goroutineLock) checkNotOn() {
|
||||||
if !http2DebugGoroutines {
|
if !http2DebugGoroutines || http2disableDebugGoroutines.Load() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if http2curGoroutineID() == uint64(g) {
|
if http2curGoroutineID() == uint64(g) {
|
||||||
|
|
@ -3647,15 +3643,13 @@ func (cw http2closeWaiter) Wait() {
|
||||||
// idle memory usage with many connections.
|
// idle memory usage with many connections.
|
||||||
type http2bufferedWriter struct {
|
type http2bufferedWriter struct {
|
||||||
_ http2incomparable
|
_ http2incomparable
|
||||||
group http2synctestGroupInterface // immutable
|
|
||||||
conn net.Conn // immutable
|
conn net.Conn // immutable
|
||||||
bw *bufio.Writer // non-nil when data is buffered
|
bw *bufio.Writer // non-nil when data is buffered
|
||||||
byteTimeout time.Duration // immutable, WriteByteTimeout
|
byteTimeout time.Duration // immutable, WriteByteTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
func http2newBufferedWriter(group http2synctestGroupInterface, conn net.Conn, timeout time.Duration) *http2bufferedWriter {
|
func http2newBufferedWriter(conn net.Conn, timeout time.Duration) *http2bufferedWriter {
|
||||||
return &http2bufferedWriter{
|
return &http2bufferedWriter{
|
||||||
group: group,
|
|
||||||
conn: conn,
|
conn: conn,
|
||||||
byteTimeout: timeout,
|
byteTimeout: timeout,
|
||||||
}
|
}
|
||||||
|
|
@ -3706,24 +3700,18 @@ func (w *http2bufferedWriter) Flush() error {
|
||||||
type http2bufferedWriterTimeoutWriter http2bufferedWriter
|
type http2bufferedWriterTimeoutWriter http2bufferedWriter
|
||||||
|
|
||||||
func (w *http2bufferedWriterTimeoutWriter) Write(p []byte) (n int, err error) {
|
func (w *http2bufferedWriterTimeoutWriter) Write(p []byte) (n int, err error) {
|
||||||
return http2writeWithByteTimeout(w.group, w.conn, w.byteTimeout, p)
|
return http2writeWithByteTimeout(w.conn, w.byteTimeout, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// writeWithByteTimeout writes to conn.
|
// writeWithByteTimeout writes to conn.
|
||||||
// If more than timeout passes without any bytes being written to the connection,
|
// If more than timeout passes without any bytes being written to the connection,
|
||||||
// the write fails.
|
// the write fails.
|
||||||
func http2writeWithByteTimeout(group http2synctestGroupInterface, conn net.Conn, timeout time.Duration, p []byte) (n int, err error) {
|
func http2writeWithByteTimeout(conn net.Conn, timeout time.Duration, p []byte) (n int, err error) {
|
||||||
if timeout <= 0 {
|
if timeout <= 0 {
|
||||||
return conn.Write(p)
|
return conn.Write(p)
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
var now time.Time
|
conn.SetWriteDeadline(time.Now().Add(timeout))
|
||||||
if group == nil {
|
|
||||||
now = time.Now()
|
|
||||||
} else {
|
|
||||||
now = group.Now()
|
|
||||||
}
|
|
||||||
conn.SetWriteDeadline(now.Add(timeout))
|
|
||||||
nn, err := conn.Write(p[n:])
|
nn, err := conn.Write(p[n:])
|
||||||
n += nn
|
n += nn
|
||||||
if n == len(p) || nn == 0 || !errors.Is(err, os.ErrDeadlineExceeded) {
|
if n == len(p) || nn == 0 || !errors.Is(err, os.ErrDeadlineExceeded) {
|
||||||
|
|
@ -3814,17 +3802,6 @@ func (s *http2sorter) SortStrings(ss []string) {
|
||||||
// any size (as long as it's first).
|
// any size (as long as it's first).
|
||||||
type http2incomparable [0]func()
|
type http2incomparable [0]func()
|
||||||
|
|
||||||
// synctestGroupInterface is the methods of synctestGroup used by Server and Transport.
|
|
||||||
// It's defined as an interface here to let us keep synctestGroup entirely test-only
|
|
||||||
// and not a part of non-test builds.
|
|
||||||
type http2synctestGroupInterface interface {
|
|
||||||
Join()
|
|
||||||
Now() time.Time
|
|
||||||
NewTimer(d time.Duration) http2timer
|
|
||||||
AfterFunc(d time.Duration, f func()) http2timer
|
|
||||||
ContextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc)
|
|
||||||
}
|
|
||||||
|
|
||||||
// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
|
// pipe is a goroutine-safe io.Reader/io.Writer pair. It's like
|
||||||
// io.Pipe except there are no PipeReader/PipeWriter halves, and the
|
// io.Pipe except there are no PipeReader/PipeWriter halves, and the
|
||||||
// underlying buffer is an interface. (io.Pipe is always unbuffered)
|
// underlying buffer is an interface. (io.Pipe is always unbuffered)
|
||||||
|
|
@ -4121,39 +4098,6 @@ type http2Server struct {
|
||||||
// so that we don't embed a Mutex in this struct, which will make the
|
// so that we don't embed a Mutex in this struct, which will make the
|
||||||
// struct non-copyable, which might break some callers.
|
// struct non-copyable, which might break some callers.
|
||||||
state *http2serverInternalState
|
state *http2serverInternalState
|
||||||
|
|
||||||
// Synchronization group used for testing.
|
|
||||||
// Outside of tests, this is nil.
|
|
||||||
group http2synctestGroupInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *http2Server) markNewGoroutine() {
|
|
||||||
if s.group != nil {
|
|
||||||
s.group.Join()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *http2Server) now() time.Time {
|
|
||||||
if s.group != nil {
|
|
||||||
return s.group.Now()
|
|
||||||
}
|
|
||||||
return time.Now()
|
|
||||||
}
|
|
||||||
|
|
||||||
// newTimer creates a new time.Timer, or a synthetic timer in tests.
|
|
||||||
func (s *http2Server) newTimer(d time.Duration) http2timer {
|
|
||||||
if s.group != nil {
|
|
||||||
return s.group.NewTimer(d)
|
|
||||||
}
|
|
||||||
return http2timeTimer{time.NewTimer(d)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
|
|
||||||
func (s *http2Server) afterFunc(d time.Duration, f func()) http2timer {
|
|
||||||
if s.group != nil {
|
|
||||||
return s.group.AfterFunc(d, f)
|
|
||||||
}
|
|
||||||
return http2timeTimer{time.AfterFunc(d, f)}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type http2serverInternalState struct {
|
type http2serverInternalState struct {
|
||||||
|
|
@ -4368,6 +4312,9 @@ func (o *http2ServeConnOpts) handler() Handler {
|
||||||
//
|
//
|
||||||
// The opts parameter is optional. If nil, default values are used.
|
// The opts parameter is optional. If nil, default values are used.
|
||||||
func (s *http2Server) ServeConn(c net.Conn, opts *http2ServeConnOpts) {
|
func (s *http2Server) ServeConn(c net.Conn, opts *http2ServeConnOpts) {
|
||||||
|
if opts == nil {
|
||||||
|
opts = &http2ServeConnOpts{}
|
||||||
|
}
|
||||||
s.serveConn(c, opts, nil)
|
s.serveConn(c, opts, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4383,7 +4330,7 @@ func (s *http2Server) serveConn(c net.Conn, opts *http2ServeConnOpts, newf func(
|
||||||
conn: c,
|
conn: c,
|
||||||
baseCtx: baseCtx,
|
baseCtx: baseCtx,
|
||||||
remoteAddrStr: c.RemoteAddr().String(),
|
remoteAddrStr: c.RemoteAddr().String(),
|
||||||
bw: http2newBufferedWriter(s.group, c, conf.WriteByteTimeout),
|
bw: http2newBufferedWriter(c, conf.WriteByteTimeout),
|
||||||
handler: opts.handler(),
|
handler: opts.handler(),
|
||||||
streams: make(map[uint32]*http2stream),
|
streams: make(map[uint32]*http2stream),
|
||||||
readFrameCh: make(chan http2readFrameResult),
|
readFrameCh: make(chan http2readFrameResult),
|
||||||
|
|
@ -4583,11 +4530,11 @@ type http2serverConn struct {
|
||||||
pingSent bool
|
pingSent bool
|
||||||
sentPingData [8]byte
|
sentPingData [8]byte
|
||||||
goAwayCode http2ErrCode
|
goAwayCode http2ErrCode
|
||||||
shutdownTimer http2timer // nil until used
|
shutdownTimer *time.Timer // nil until used
|
||||||
idleTimer http2timer // nil if unused
|
idleTimer *time.Timer // nil if unused
|
||||||
readIdleTimeout time.Duration
|
readIdleTimeout time.Duration
|
||||||
pingTimeout time.Duration
|
pingTimeout time.Duration
|
||||||
readIdleTimer http2timer // nil if unused
|
readIdleTimer *time.Timer // nil if unused
|
||||||
|
|
||||||
// Owned by the writeFrameAsync goroutine:
|
// Owned by the writeFrameAsync goroutine:
|
||||||
headerWriteBuf bytes.Buffer
|
headerWriteBuf bytes.Buffer
|
||||||
|
|
@ -4635,8 +4582,8 @@ type http2stream struct {
|
||||||
resetQueued bool // RST_STREAM queued for write; set by sc.resetStream
|
resetQueued bool // RST_STREAM queued for write; set by sc.resetStream
|
||||||
gotTrailerHeader bool // HEADER frame for trailers was seen
|
gotTrailerHeader bool // HEADER frame for trailers was seen
|
||||||
wroteHeaders bool // whether we wrote headers (not status 100)
|
wroteHeaders bool // whether we wrote headers (not status 100)
|
||||||
readDeadline http2timer // nil if unused
|
readDeadline *time.Timer // nil if unused
|
||||||
writeDeadline http2timer // nil if unused
|
writeDeadline *time.Timer // nil if unused
|
||||||
closeErr error // set before cw is closed
|
closeErr error // set before cw is closed
|
||||||
|
|
||||||
trailer Header // accumulated trailers
|
trailer Header // accumulated trailers
|
||||||
|
|
@ -4796,7 +4743,6 @@ type http2readFrameResult struct {
|
||||||
// consumer is done with the frame.
|
// consumer is done with the frame.
|
||||||
// It's run on its own goroutine.
|
// It's run on its own goroutine.
|
||||||
func (sc *http2serverConn) readFrames() {
|
func (sc *http2serverConn) readFrames() {
|
||||||
sc.srv.markNewGoroutine()
|
|
||||||
gate := make(chan struct{})
|
gate := make(chan struct{})
|
||||||
gateDone := func() { gate <- struct{}{} }
|
gateDone := func() { gate <- struct{}{} }
|
||||||
for {
|
for {
|
||||||
|
|
@ -4829,7 +4775,6 @@ type http2frameWriteResult struct {
|
||||||
// At most one goroutine can be running writeFrameAsync at a time per
|
// At most one goroutine can be running writeFrameAsync at a time per
|
||||||
// serverConn.
|
// serverConn.
|
||||||
func (sc *http2serverConn) writeFrameAsync(wr http2FrameWriteRequest, wd *http2writeData) {
|
func (sc *http2serverConn) writeFrameAsync(wr http2FrameWriteRequest, wd *http2writeData) {
|
||||||
sc.srv.markNewGoroutine()
|
|
||||||
var err error
|
var err error
|
||||||
if wd == nil {
|
if wd == nil {
|
||||||
err = wr.write.writeFrame(sc)
|
err = wr.write.writeFrame(sc)
|
||||||
|
|
@ -4913,22 +4858,22 @@ func (sc *http2serverConn) serve(conf http2http2Config) {
|
||||||
sc.setConnState(StateIdle)
|
sc.setConnState(StateIdle)
|
||||||
|
|
||||||
if sc.srv.IdleTimeout > 0 {
|
if sc.srv.IdleTimeout > 0 {
|
||||||
sc.idleTimer = sc.srv.afterFunc(sc.srv.IdleTimeout, sc.onIdleTimer)
|
sc.idleTimer = time.AfterFunc(sc.srv.IdleTimeout, sc.onIdleTimer)
|
||||||
defer sc.idleTimer.Stop()
|
defer sc.idleTimer.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
if conf.SendPingTimeout > 0 {
|
if conf.SendPingTimeout > 0 {
|
||||||
sc.readIdleTimeout = conf.SendPingTimeout
|
sc.readIdleTimeout = conf.SendPingTimeout
|
||||||
sc.readIdleTimer = sc.srv.afterFunc(conf.SendPingTimeout, sc.onReadIdleTimer)
|
sc.readIdleTimer = time.AfterFunc(conf.SendPingTimeout, sc.onReadIdleTimer)
|
||||||
defer sc.readIdleTimer.Stop()
|
defer sc.readIdleTimer.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
go sc.readFrames() // closed by defer sc.conn.Close above
|
go sc.readFrames() // closed by defer sc.conn.Close above
|
||||||
|
|
||||||
settingsTimer := sc.srv.afterFunc(http2firstSettingsTimeout, sc.onSettingsTimer)
|
settingsTimer := time.AfterFunc(http2firstSettingsTimeout, sc.onSettingsTimer)
|
||||||
defer settingsTimer.Stop()
|
defer settingsTimer.Stop()
|
||||||
|
|
||||||
lastFrameTime := sc.srv.now()
|
lastFrameTime := time.Now()
|
||||||
loopNum := 0
|
loopNum := 0
|
||||||
for {
|
for {
|
||||||
loopNum++
|
loopNum++
|
||||||
|
|
@ -4942,7 +4887,7 @@ func (sc *http2serverConn) serve(conf http2http2Config) {
|
||||||
case res := <-sc.wroteFrameCh:
|
case res := <-sc.wroteFrameCh:
|
||||||
sc.wroteFrame(res)
|
sc.wroteFrame(res)
|
||||||
case res := <-sc.readFrameCh:
|
case res := <-sc.readFrameCh:
|
||||||
lastFrameTime = sc.srv.now()
|
lastFrameTime = time.Now()
|
||||||
// Process any written frames before reading new frames from the client since a
|
// Process any written frames before reading new frames from the client since a
|
||||||
// written frame could have triggered a new stream to be started.
|
// written frame could have triggered a new stream to be started.
|
||||||
if sc.writingFrameAsync {
|
if sc.writingFrameAsync {
|
||||||
|
|
@ -5025,7 +4970,7 @@ func (sc *http2serverConn) handlePingTimer(lastFrameReadTime time.Time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pingAt := lastFrameReadTime.Add(sc.readIdleTimeout)
|
pingAt := lastFrameReadTime.Add(sc.readIdleTimeout)
|
||||||
now := sc.srv.now()
|
now := time.Now()
|
||||||
if pingAt.After(now) {
|
if pingAt.After(now) {
|
||||||
// We received frames since arming the ping timer.
|
// We received frames since arming the ping timer.
|
||||||
// Reset it for the next possible timeout.
|
// Reset it for the next possible timeout.
|
||||||
|
|
@ -5092,10 +5037,10 @@ func (sc *http2serverConn) readPreface() error {
|
||||||
errc <- nil
|
errc <- nil
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
timer := sc.srv.newTimer(http2prefaceTimeout) // TODO: configurable on *Server?
|
timer := time.NewTimer(http2prefaceTimeout) // TODO: configurable on *Server?
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
select {
|
select {
|
||||||
case <-timer.C():
|
case <-timer.C:
|
||||||
return http2errPrefaceTimeout
|
return http2errPrefaceTimeout
|
||||||
case err := <-errc:
|
case err := <-errc:
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
@ -5111,6 +5056,21 @@ var http2errChanPool = sync.Pool{
|
||||||
New: func() interface{} { return make(chan error, 1) },
|
New: func() interface{} { return make(chan error, 1) },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func http2getErrChan() chan error {
|
||||||
|
if http2inTests {
|
||||||
|
// Channels cannot be reused across synctest tests.
|
||||||
|
return make(chan error, 1)
|
||||||
|
} else {
|
||||||
|
return http2errChanPool.Get().(chan error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func http2putErrChan(ch chan error) {
|
||||||
|
if !http2inTests {
|
||||||
|
http2errChanPool.Put(ch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var http2writeDataPool = sync.Pool{
|
var http2writeDataPool = sync.Pool{
|
||||||
New: func() interface{} { return new(http2writeData) },
|
New: func() interface{} { return new(http2writeData) },
|
||||||
}
|
}
|
||||||
|
|
@ -5118,7 +5078,7 @@ var http2writeDataPool = sync.Pool{
|
||||||
// writeDataFromHandler writes DATA response frames from a handler on
|
// writeDataFromHandler writes DATA response frames from a handler on
|
||||||
// the given stream.
|
// the given stream.
|
||||||
func (sc *http2serverConn) writeDataFromHandler(stream *http2stream, data []byte, endStream bool) error {
|
func (sc *http2serverConn) writeDataFromHandler(stream *http2stream, data []byte, endStream bool) error {
|
||||||
ch := http2errChanPool.Get().(chan error)
|
ch := http2getErrChan()
|
||||||
writeArg := http2writeDataPool.Get().(*http2writeData)
|
writeArg := http2writeDataPool.Get().(*http2writeData)
|
||||||
*writeArg = http2writeData{stream.id, data, endStream}
|
*writeArg = http2writeData{stream.id, data, endStream}
|
||||||
err := sc.writeFrameFromHandler(http2FrameWriteRequest{
|
err := sc.writeFrameFromHandler(http2FrameWriteRequest{
|
||||||
|
|
@ -5150,7 +5110,7 @@ func (sc *http2serverConn) writeDataFromHandler(stream *http2stream, data []byte
|
||||||
return http2errStreamClosed
|
return http2errStreamClosed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
http2errChanPool.Put(ch)
|
http2putErrChan(ch)
|
||||||
if frameWriteDone {
|
if frameWriteDone {
|
||||||
http2writeDataPool.Put(writeArg)
|
http2writeDataPool.Put(writeArg)
|
||||||
}
|
}
|
||||||
|
|
@ -5464,7 +5424,7 @@ func (sc *http2serverConn) goAway(code http2ErrCode) {
|
||||||
|
|
||||||
func (sc *http2serverConn) shutDownIn(d time.Duration) {
|
func (sc *http2serverConn) shutDownIn(d time.Duration) {
|
||||||
sc.serveG.check()
|
sc.serveG.check()
|
||||||
sc.shutdownTimer = sc.srv.afterFunc(d, sc.onShutdownTimer)
|
sc.shutdownTimer = time.AfterFunc(d, sc.onShutdownTimer)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sc *http2serverConn) resetStream(se http2StreamError) {
|
func (sc *http2serverConn) resetStream(se http2StreamError) {
|
||||||
|
|
@ -6069,7 +6029,7 @@ func (sc *http2serverConn) processHeaders(f *http2MetaHeadersFrame) error {
|
||||||
// (in Go 1.8), though. That's a more sane option anyway.
|
// (in Go 1.8), though. That's a more sane option anyway.
|
||||||
if sc.hs.ReadTimeout > 0 {
|
if sc.hs.ReadTimeout > 0 {
|
||||||
sc.conn.SetReadDeadline(time.Time{})
|
sc.conn.SetReadDeadline(time.Time{})
|
||||||
st.readDeadline = sc.srv.afterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
|
st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sc.scheduleHandler(id, rw, req, handler)
|
return sc.scheduleHandler(id, rw, req, handler)
|
||||||
|
|
@ -6167,7 +6127,7 @@ func (sc *http2serverConn) newStream(id, pusherID uint32, state http2streamState
|
||||||
st.flow.add(sc.initialStreamSendWindowSize)
|
st.flow.add(sc.initialStreamSendWindowSize)
|
||||||
st.inflow.init(sc.initialStreamRecvWindowSize)
|
st.inflow.init(sc.initialStreamRecvWindowSize)
|
||||||
if sc.hs.WriteTimeout > 0 {
|
if sc.hs.WriteTimeout > 0 {
|
||||||
st.writeDeadline = sc.srv.afterFunc(sc.hs.WriteTimeout, st.onWriteTimeout)
|
st.writeDeadline = time.AfterFunc(sc.hs.WriteTimeout, st.onWriteTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
sc.streams[id] = st
|
sc.streams[id] = st
|
||||||
|
|
@ -6356,7 +6316,6 @@ func (sc *http2serverConn) handlerDone() {
|
||||||
|
|
||||||
// Run on its own goroutine.
|
// Run on its own goroutine.
|
||||||
func (sc *http2serverConn) runHandler(rw *http2responseWriter, req *Request, handler func(ResponseWriter, *Request)) {
|
func (sc *http2serverConn) runHandler(rw *http2responseWriter, req *Request, handler func(ResponseWriter, *Request)) {
|
||||||
sc.srv.markNewGoroutine()
|
|
||||||
defer sc.sendServeMsg(http2handlerDoneMsg)
|
defer sc.sendServeMsg(http2handlerDoneMsg)
|
||||||
didPanic := true
|
didPanic := true
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
@ -6405,7 +6364,7 @@ func (sc *http2serverConn) writeHeaders(st *http2stream, headerData *http2writeR
|
||||||
// waiting for this frame to be written, so an http.Flush mid-handler
|
// waiting for this frame to be written, so an http.Flush mid-handler
|
||||||
// writes out the correct value of keys, before a handler later potentially
|
// writes out the correct value of keys, before a handler later potentially
|
||||||
// mutates it.
|
// mutates it.
|
||||||
errc = http2errChanPool.Get().(chan error)
|
errc = http2getErrChan()
|
||||||
}
|
}
|
||||||
if err := sc.writeFrameFromHandler(http2FrameWriteRequest{
|
if err := sc.writeFrameFromHandler(http2FrameWriteRequest{
|
||||||
write: headerData,
|
write: headerData,
|
||||||
|
|
@ -6417,7 +6376,7 @@ func (sc *http2serverConn) writeHeaders(st *http2stream, headerData *http2writeR
|
||||||
if errc != nil {
|
if errc != nil {
|
||||||
select {
|
select {
|
||||||
case err := <-errc:
|
case err := <-errc:
|
||||||
http2errChanPool.Put(errc)
|
http2putErrChan(errc)
|
||||||
return err
|
return err
|
||||||
case <-sc.doneServing:
|
case <-sc.doneServing:
|
||||||
return http2errClientDisconnected
|
return http2errClientDisconnected
|
||||||
|
|
@ -6524,7 +6483,7 @@ func (b *http2requestBody) Read(p []byte) (n int, err error) {
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
b.sawEOF = true
|
b.sawEOF = true
|
||||||
}
|
}
|
||||||
if b.conn == nil && http2inTests {
|
if b.conn == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
b.conn.noteBodyReadFromHandler(b.stream, n, err)
|
b.conn.noteBodyReadFromHandler(b.stream, n, err)
|
||||||
|
|
@ -6653,7 +6612,7 @@ func (rws *http2responseWriterState) writeChunk(p []byte) (n int, err error) {
|
||||||
var date string
|
var date string
|
||||||
if _, ok := rws.snapHeader["Date"]; !ok {
|
if _, ok := rws.snapHeader["Date"]; !ok {
|
||||||
// TODO(bradfitz): be faster here, like net/http? measure.
|
// TODO(bradfitz): be faster here, like net/http? measure.
|
||||||
date = rws.conn.srv.now().UTC().Format(TimeFormat)
|
date = time.Now().UTC().Format(TimeFormat)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range rws.snapHeader["Trailer"] {
|
for _, v := range rws.snapHeader["Trailer"] {
|
||||||
|
|
@ -6775,7 +6734,7 @@ func (rws *http2responseWriterState) promoteUndeclaredTrailers() {
|
||||||
|
|
||||||
func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error {
|
func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error {
|
||||||
st := w.rws.stream
|
st := w.rws.stream
|
||||||
if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) {
|
if !deadline.IsZero() && deadline.Before(time.Now()) {
|
||||||
// If we're setting a deadline in the past, reset the stream immediately
|
// If we're setting a deadline in the past, reset the stream immediately
|
||||||
// so writes after SetWriteDeadline returns will fail.
|
// so writes after SetWriteDeadline returns will fail.
|
||||||
st.onReadTimeout()
|
st.onReadTimeout()
|
||||||
|
|
@ -6791,9 +6750,9 @@ func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error {
|
||||||
if deadline.IsZero() {
|
if deadline.IsZero() {
|
||||||
st.readDeadline = nil
|
st.readDeadline = nil
|
||||||
} else if st.readDeadline == nil {
|
} else if st.readDeadline == nil {
|
||||||
st.readDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onReadTimeout)
|
st.readDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onReadTimeout)
|
||||||
} else {
|
} else {
|
||||||
st.readDeadline.Reset(deadline.Sub(sc.srv.now()))
|
st.readDeadline.Reset(deadline.Sub(time.Now()))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -6801,7 +6760,7 @@ func (w *http2responseWriter) SetReadDeadline(deadline time.Time) error {
|
||||||
|
|
||||||
func (w *http2responseWriter) SetWriteDeadline(deadline time.Time) error {
|
func (w *http2responseWriter) SetWriteDeadline(deadline time.Time) error {
|
||||||
st := w.rws.stream
|
st := w.rws.stream
|
||||||
if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) {
|
if !deadline.IsZero() && deadline.Before(time.Now()) {
|
||||||
// If we're setting a deadline in the past, reset the stream immediately
|
// If we're setting a deadline in the past, reset the stream immediately
|
||||||
// so writes after SetWriteDeadline returns will fail.
|
// so writes after SetWriteDeadline returns will fail.
|
||||||
st.onWriteTimeout()
|
st.onWriteTimeout()
|
||||||
|
|
@ -6817,9 +6776,9 @@ func (w *http2responseWriter) SetWriteDeadline(deadline time.Time) error {
|
||||||
if deadline.IsZero() {
|
if deadline.IsZero() {
|
||||||
st.writeDeadline = nil
|
st.writeDeadline = nil
|
||||||
} else if st.writeDeadline == nil {
|
} else if st.writeDeadline == nil {
|
||||||
st.writeDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onWriteTimeout)
|
st.writeDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onWriteTimeout)
|
||||||
} else {
|
} else {
|
||||||
st.writeDeadline.Reset(deadline.Sub(sc.srv.now()))
|
st.writeDeadline.Reset(deadline.Sub(time.Now()))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -7098,7 +7057,7 @@ func (w *http2responseWriter) Push(target string, opts *PushOptions) error {
|
||||||
method: opts.Method,
|
method: opts.Method,
|
||||||
url: u,
|
url: u,
|
||||||
header: http2cloneHeader(opts.Header),
|
header: http2cloneHeader(opts.Header),
|
||||||
done: http2errChanPool.Get().(chan error),
|
done: http2getErrChan(),
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|
@ -7115,7 +7074,7 @@ func (w *http2responseWriter) Push(target string, opts *PushOptions) error {
|
||||||
case <-st.cw:
|
case <-st.cw:
|
||||||
return http2errStreamClosed
|
return http2errStreamClosed
|
||||||
case err := <-msg.done:
|
case err := <-msg.done:
|
||||||
http2errChanPool.Put(msg.done)
|
http2putErrChan(msg.done)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7300,20 +7259,6 @@ func (sc *http2serverConn) countError(name string, err error) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// A timer is a time.Timer, as an interface which can be replaced in tests.
|
|
||||||
type http2timer = interface {
|
|
||||||
C() <-chan time.Time
|
|
||||||
Reset(d time.Duration) bool
|
|
||||||
Stop() bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// timeTimer adapts a time.Timer to the timer interface.
|
|
||||||
type http2timeTimer struct {
|
|
||||||
*time.Timer
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t http2timeTimer) C() <-chan time.Time { return t.Timer.C }
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// transportDefaultConnFlow is how many connection-level flow control
|
// transportDefaultConnFlow is how many connection-level flow control
|
||||||
// tokens we give the server at start-up, past the default 64k.
|
// tokens we give the server at start-up, past the default 64k.
|
||||||
|
|
@ -7470,50 +7415,6 @@ type http2Transport struct {
|
||||||
|
|
||||||
type http2transportTestHooks struct {
|
type http2transportTestHooks struct {
|
||||||
newclientconn func(*http2ClientConn)
|
newclientconn func(*http2ClientConn)
|
||||||
group http2synctestGroupInterface
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *http2Transport) markNewGoroutine() {
|
|
||||||
if t != nil && t.http2transportTestHooks != nil {
|
|
||||||
t.http2transportTestHooks.group.Join()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *http2Transport) now() time.Time {
|
|
||||||
if t != nil && t.http2transportTestHooks != nil {
|
|
||||||
return t.http2transportTestHooks.group.Now()
|
|
||||||
}
|
|
||||||
return time.Now()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *http2Transport) timeSince(when time.Time) time.Duration {
|
|
||||||
if t != nil && t.http2transportTestHooks != nil {
|
|
||||||
return t.now().Sub(when)
|
|
||||||
}
|
|
||||||
return time.Since(when)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newTimer creates a new time.Timer, or a synthetic timer in tests.
|
|
||||||
func (t *http2Transport) newTimer(d time.Duration) http2timer {
|
|
||||||
if t.http2transportTestHooks != nil {
|
|
||||||
return t.http2transportTestHooks.group.NewTimer(d)
|
|
||||||
}
|
|
||||||
return http2timeTimer{time.NewTimer(d)}
|
|
||||||
}
|
|
||||||
|
|
||||||
// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests.
|
|
||||||
func (t *http2Transport) afterFunc(d time.Duration, f func()) http2timer {
|
|
||||||
if t.http2transportTestHooks != nil {
|
|
||||||
return t.http2transportTestHooks.group.AfterFunc(d, f)
|
|
||||||
}
|
|
||||||
return http2timeTimer{time.AfterFunc(d, f)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *http2Transport) contextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) {
|
|
||||||
if t.http2transportTestHooks != nil {
|
|
||||||
return t.http2transportTestHooks.group.ContextWithTimeout(ctx, d)
|
|
||||||
}
|
|
||||||
return context.WithTimeout(ctx, d)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *http2Transport) maxHeaderListSize() uint32 {
|
func (t *http2Transport) maxHeaderListSize() uint32 {
|
||||||
|
|
@ -7643,7 +7544,7 @@ type http2ClientConn struct {
|
||||||
readerErr error // set before readerDone is closed
|
readerErr error // set before readerDone is closed
|
||||||
|
|
||||||
idleTimeout time.Duration // or 0 for never
|
idleTimeout time.Duration // or 0 for never
|
||||||
idleTimer http2timer
|
idleTimer *time.Timer
|
||||||
|
|
||||||
mu sync.Mutex // guards following
|
mu sync.Mutex // guards following
|
||||||
cond *sync.Cond // hold mu; broadcast on flow/closed changes
|
cond *sync.Cond // hold mu; broadcast on flow/closed changes
|
||||||
|
|
@ -7811,14 +7712,12 @@ func (cs *http2clientStream) closeReqBodyLocked() {
|
||||||
cs.reqBodyClosed = make(chan struct{})
|
cs.reqBodyClosed = make(chan struct{})
|
||||||
reqBodyClosed := cs.reqBodyClosed
|
reqBodyClosed := cs.reqBodyClosed
|
||||||
go func() {
|
go func() {
|
||||||
cs.cc.t.markNewGoroutine()
|
|
||||||
cs.reqBody.Close()
|
cs.reqBody.Close()
|
||||||
close(reqBodyClosed)
|
close(reqBodyClosed)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
type http2stickyErrWriter struct {
|
type http2stickyErrWriter struct {
|
||||||
group http2synctestGroupInterface
|
|
||||||
conn net.Conn
|
conn net.Conn
|
||||||
timeout time.Duration
|
timeout time.Duration
|
||||||
err *error
|
err *error
|
||||||
|
|
@ -7828,7 +7727,7 @@ func (sew http2stickyErrWriter) Write(p []byte) (n int, err error) {
|
||||||
if *sew.err != nil {
|
if *sew.err != nil {
|
||||||
return 0, *sew.err
|
return 0, *sew.err
|
||||||
}
|
}
|
||||||
n, err = http2writeWithByteTimeout(sew.group, sew.conn, sew.timeout, p)
|
n, err = http2writeWithByteTimeout(sew.conn, sew.timeout, p)
|
||||||
*sew.err = err
|
*sew.err = err
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
|
@ -7928,9 +7827,9 @@ func (t *http2Transport) RoundTripOpt(req *Request, opt http2RoundTripOpt) (*Res
|
||||||
backoff := float64(uint(1) << (uint(retry) - 1))
|
backoff := float64(uint(1) << (uint(retry) - 1))
|
||||||
backoff += backoff * (0.1 * mathrand.Float64())
|
backoff += backoff * (0.1 * mathrand.Float64())
|
||||||
d := time.Second * time.Duration(backoff)
|
d := time.Second * time.Duration(backoff)
|
||||||
tm := t.newTimer(d)
|
tm := time.NewTimer(d)
|
||||||
select {
|
select {
|
||||||
case <-tm.C():
|
case <-tm.C:
|
||||||
t.vlogf("RoundTrip retrying after failure: %v", roundTripErr)
|
t.vlogf("RoundTrip retrying after failure: %v", roundTripErr)
|
||||||
continue
|
continue
|
||||||
case <-req.Context().Done():
|
case <-req.Context().Done():
|
||||||
|
|
@ -7977,6 +7876,7 @@ var (
|
||||||
http2errClientConnUnusable = errors.New("http2: client conn not usable")
|
http2errClientConnUnusable = errors.New("http2: client conn not usable")
|
||||||
http2errClientConnNotEstablished = errors.New("http2: client conn could not be established")
|
http2errClientConnNotEstablished = errors.New("http2: client conn could not be established")
|
||||||
http2errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY")
|
http2errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY")
|
||||||
|
http2errClientConnForceClosed = errors.New("http2: client connection force closed via ClientConn.Close")
|
||||||
)
|
)
|
||||||
|
|
||||||
// shouldRetryRequest is called by RoundTrip when a request fails to get
|
// shouldRetryRequest is called by RoundTrip when a request fails to get
|
||||||
|
|
@ -8116,14 +8016,11 @@ func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2Client
|
||||||
pingTimeout: conf.PingTimeout,
|
pingTimeout: conf.PingTimeout,
|
||||||
pings: make(map[[8]byte]chan struct{}),
|
pings: make(map[[8]byte]chan struct{}),
|
||||||
reqHeaderMu: make(chan struct{}, 1),
|
reqHeaderMu: make(chan struct{}, 1),
|
||||||
lastActive: t.now(),
|
lastActive: time.Now(),
|
||||||
}
|
}
|
||||||
var group http2synctestGroupInterface
|
|
||||||
if t.http2transportTestHooks != nil {
|
if t.http2transportTestHooks != nil {
|
||||||
t.markNewGoroutine()
|
|
||||||
t.http2transportTestHooks.newclientconn(cc)
|
t.http2transportTestHooks.newclientconn(cc)
|
||||||
c = cc.tconn
|
c = cc.tconn
|
||||||
group = t.group
|
|
||||||
}
|
}
|
||||||
if http2VerboseLogs {
|
if http2VerboseLogs {
|
||||||
t.vlogf("http2: Transport creating client conn %p to %v", cc, c.RemoteAddr())
|
t.vlogf("http2: Transport creating client conn %p to %v", cc, c.RemoteAddr())
|
||||||
|
|
@ -8135,7 +8032,6 @@ func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2Client
|
||||||
// TODO: adjust this writer size to account for frame size +
|
// TODO: adjust this writer size to account for frame size +
|
||||||
// MTU + crypto/tls record padding.
|
// MTU + crypto/tls record padding.
|
||||||
cc.bw = bufio.NewWriter(http2stickyErrWriter{
|
cc.bw = bufio.NewWriter(http2stickyErrWriter{
|
||||||
group: group,
|
|
||||||
conn: c,
|
conn: c,
|
||||||
timeout: conf.WriteByteTimeout,
|
timeout: conf.WriteByteTimeout,
|
||||||
err: &cc.werr,
|
err: &cc.werr,
|
||||||
|
|
@ -8184,7 +8080,7 @@ func (t *http2Transport) newClientConn(c net.Conn, singleUse bool) (*http2Client
|
||||||
// Start the idle timer after the connection is fully initialized.
|
// Start the idle timer after the connection is fully initialized.
|
||||||
if d := t.idleConnTimeout(); d != 0 {
|
if d := t.idleConnTimeout(); d != 0 {
|
||||||
cc.idleTimeout = d
|
cc.idleTimeout = d
|
||||||
cc.idleTimer = t.afterFunc(d, cc.onIdleTimeout)
|
cc.idleTimer = time.AfterFunc(d, cc.onIdleTimeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
go cc.readLoop()
|
go cc.readLoop()
|
||||||
|
|
@ -8195,7 +8091,7 @@ func (cc *http2ClientConn) healthCheck() {
|
||||||
pingTimeout := cc.pingTimeout
|
pingTimeout := cc.pingTimeout
|
||||||
// We don't need to periodically ping in the health check, because the readLoop of ClientConn will
|
// We don't need to periodically ping in the health check, because the readLoop of ClientConn will
|
||||||
// trigger the healthCheck again if there is no frame received.
|
// trigger the healthCheck again if there is no frame received.
|
||||||
ctx, cancel := cc.t.contextWithTimeout(context.Background(), pingTimeout)
|
ctx, cancel := context.WithTimeout(context.Background(), pingTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
cc.vlogf("http2: Transport sending health check")
|
cc.vlogf("http2: Transport sending health check")
|
||||||
err := cc.Ping(ctx)
|
err := cc.Ping(ctx)
|
||||||
|
|
@ -8398,7 +8294,7 @@ func (cc *http2ClientConn) tooIdleLocked() bool {
|
||||||
// times are compared based on their wall time. We don't want
|
// times are compared based on their wall time. We don't want
|
||||||
// to reuse a connection that's been sitting idle during
|
// to reuse a connection that's been sitting idle during
|
||||||
// VM/laptop suspend if monotonic time was also frozen.
|
// VM/laptop suspend if monotonic time was also frozen.
|
||||||
return cc.idleTimeout != 0 && !cc.lastIdle.IsZero() && cc.t.timeSince(cc.lastIdle.Round(0)) > cc.idleTimeout
|
return cc.idleTimeout != 0 && !cc.lastIdle.IsZero() && time.Since(cc.lastIdle.Round(0)) > cc.idleTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
// onIdleTimeout is called from a time.AfterFunc goroutine. It will
|
// onIdleTimeout is called from a time.AfterFunc goroutine. It will
|
||||||
|
|
@ -8464,7 +8360,6 @@ func (cc *http2ClientConn) Shutdown(ctx context.Context) error {
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
cancelled := false // guarded by cc.mu
|
cancelled := false // guarded by cc.mu
|
||||||
go func() {
|
go func() {
|
||||||
cc.t.markNewGoroutine()
|
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
defer cc.mu.Unlock()
|
defer cc.mu.Unlock()
|
||||||
for {
|
for {
|
||||||
|
|
@ -8535,8 +8430,7 @@ func (cc *http2ClientConn) closeForError(err error) {
|
||||||
//
|
//
|
||||||
// In-flight requests are interrupted. For a graceful shutdown, use Shutdown instead.
|
// In-flight requests are interrupted. For a graceful shutdown, use Shutdown instead.
|
||||||
func (cc *http2ClientConn) Close() error {
|
func (cc *http2ClientConn) Close() error {
|
||||||
err := errors.New("http2: client connection force closed via ClientConn.Close")
|
cc.closeForError(http2errClientConnForceClosed)
|
||||||
cc.closeForError(err)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -8705,7 +8599,6 @@ func (cc *http2ClientConn) roundTrip(req *Request, streamf func(*http2clientStre
|
||||||
//
|
//
|
||||||
// It sends the request and performs post-request cleanup (closing Request.Body, etc.).
|
// It sends the request and performs post-request cleanup (closing Request.Body, etc.).
|
||||||
func (cs *http2clientStream) doRequest(req *Request, streamf func(*http2clientStream)) {
|
func (cs *http2clientStream) doRequest(req *Request, streamf func(*http2clientStream)) {
|
||||||
cs.cc.t.markNewGoroutine()
|
|
||||||
err := cs.writeRequest(req, streamf)
|
err := cs.writeRequest(req, streamf)
|
||||||
cs.cleanupWriteRequest(err)
|
cs.cleanupWriteRequest(err)
|
||||||
}
|
}
|
||||||
|
|
@ -8836,9 +8729,9 @@ func (cs *http2clientStream) writeRequest(req *Request, streamf func(*http2clien
|
||||||
var respHeaderTimer <-chan time.Time
|
var respHeaderTimer <-chan time.Time
|
||||||
var respHeaderRecv chan struct{}
|
var respHeaderRecv chan struct{}
|
||||||
if d := cc.responseHeaderTimeout(); d != 0 {
|
if d := cc.responseHeaderTimeout(); d != 0 {
|
||||||
timer := cc.t.newTimer(d)
|
timer := time.NewTimer(d)
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
respHeaderTimer = timer.C()
|
respHeaderTimer = timer.C
|
||||||
respHeaderRecv = cs.respHeaderRecv
|
respHeaderRecv = cs.respHeaderRecv
|
||||||
}
|
}
|
||||||
// Wait until the peer half-closes its end of the stream,
|
// Wait until the peer half-closes its end of the stream,
|
||||||
|
|
@ -9031,7 +8924,7 @@ func (cc *http2ClientConn) awaitOpenSlotForStreamLocked(cs *http2clientStream) e
|
||||||
// Return a fatal error which aborts the retry loop.
|
// Return a fatal error which aborts the retry loop.
|
||||||
return http2errClientConnNotEstablished
|
return http2errClientConnNotEstablished
|
||||||
}
|
}
|
||||||
cc.lastActive = cc.t.now()
|
cc.lastActive = time.Now()
|
||||||
if cc.closed || !cc.canTakeNewRequestLocked() {
|
if cc.closed || !cc.canTakeNewRequestLocked() {
|
||||||
return http2errClientConnUnusable
|
return http2errClientConnUnusable
|
||||||
}
|
}
|
||||||
|
|
@ -9371,10 +9264,10 @@ func (cc *http2ClientConn) forgetStreamID(id uint32) {
|
||||||
if len(cc.streams) != slen-1 {
|
if len(cc.streams) != slen-1 {
|
||||||
panic("forgetting unknown stream id")
|
panic("forgetting unknown stream id")
|
||||||
}
|
}
|
||||||
cc.lastActive = cc.t.now()
|
cc.lastActive = time.Now()
|
||||||
if len(cc.streams) == 0 && cc.idleTimer != nil {
|
if len(cc.streams) == 0 && cc.idleTimer != nil {
|
||||||
cc.idleTimer.Reset(cc.idleTimeout)
|
cc.idleTimer.Reset(cc.idleTimeout)
|
||||||
cc.lastIdle = cc.t.now()
|
cc.lastIdle = time.Now()
|
||||||
}
|
}
|
||||||
// Wake up writeRequestBody via clientStream.awaitFlowControl and
|
// Wake up writeRequestBody via clientStream.awaitFlowControl and
|
||||||
// wake up RoundTrip if there is a pending request.
|
// wake up RoundTrip if there is a pending request.
|
||||||
|
|
@ -9400,7 +9293,6 @@ type http2clientConnReadLoop struct {
|
||||||
|
|
||||||
// readLoop runs in its own goroutine and reads and dispatches frames.
|
// readLoop runs in its own goroutine and reads and dispatches frames.
|
||||||
func (cc *http2ClientConn) readLoop() {
|
func (cc *http2ClientConn) readLoop() {
|
||||||
cc.t.markNewGoroutine()
|
|
||||||
rl := &http2clientConnReadLoop{cc: cc}
|
rl := &http2clientConnReadLoop{cc: cc}
|
||||||
defer rl.cleanup()
|
defer rl.cleanup()
|
||||||
cc.readerErr = rl.run()
|
cc.readerErr = rl.run()
|
||||||
|
|
@ -9467,9 +9359,9 @@ func (rl *http2clientConnReadLoop) cleanup() {
|
||||||
if cc.idleTimeout > 0 && unusedWaitTime > cc.idleTimeout {
|
if cc.idleTimeout > 0 && unusedWaitTime > cc.idleTimeout {
|
||||||
unusedWaitTime = cc.idleTimeout
|
unusedWaitTime = cc.idleTimeout
|
||||||
}
|
}
|
||||||
idleTime := cc.t.now().Sub(cc.lastActive)
|
idleTime := time.Now().Sub(cc.lastActive)
|
||||||
if atomic.LoadUint32(&cc.atomicReused) == 0 && idleTime < unusedWaitTime && !cc.closedOnIdle {
|
if atomic.LoadUint32(&cc.atomicReused) == 0 && idleTime < unusedWaitTime && !cc.closedOnIdle {
|
||||||
cc.idleTimer = cc.t.afterFunc(unusedWaitTime-idleTime, func() {
|
cc.idleTimer = time.AfterFunc(unusedWaitTime-idleTime, func() {
|
||||||
cc.t.connPool().MarkDead(cc)
|
cc.t.connPool().MarkDead(cc)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -9529,9 +9421,9 @@ func (rl *http2clientConnReadLoop) run() error {
|
||||||
cc := rl.cc
|
cc := rl.cc
|
||||||
gotSettings := false
|
gotSettings := false
|
||||||
readIdleTimeout := cc.readIdleTimeout
|
readIdleTimeout := cc.readIdleTimeout
|
||||||
var t http2timer
|
var t *time.Timer
|
||||||
if readIdleTimeout != 0 {
|
if readIdleTimeout != 0 {
|
||||||
t = cc.t.afterFunc(readIdleTimeout, cc.healthCheck)
|
t = time.AfterFunc(readIdleTimeout, cc.healthCheck)
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
f, err := cc.fr.ReadFrame()
|
f, err := cc.fr.ReadFrame()
|
||||||
|
|
@ -10277,7 +10169,6 @@ func (cc *http2ClientConn) Ping(ctx context.Context) error {
|
||||||
var pingError error
|
var pingError error
|
||||||
errc := make(chan struct{})
|
errc := make(chan struct{})
|
||||||
go func() {
|
go func() {
|
||||||
cc.t.markNewGoroutine()
|
|
||||||
cc.wmu.Lock()
|
cc.wmu.Lock()
|
||||||
defer cc.wmu.Unlock()
|
defer cc.wmu.Unlock()
|
||||||
if pingError = cc.fr.WritePing(false, p); pingError != nil {
|
if pingError = cc.fr.WritePing(false, p); pingError != nil {
|
||||||
|
|
@ -10510,7 +10401,7 @@ func http2traceGotConn(req *Request, cc *http2ClientConn, reused bool) {
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
ci.WasIdle = len(cc.streams) == 0 && reused
|
ci.WasIdle = len(cc.streams) == 0 && reused
|
||||||
if ci.WasIdle && !cc.lastActive.IsZero() {
|
if ci.WasIdle && !cc.lastActive.IsZero() {
|
||||||
ci.IdleTime = cc.t.timeSince(cc.lastActive)
|
ci.IdleTime = time.Since(cc.lastActive)
|
||||||
}
|
}
|
||||||
cc.mu.Unlock()
|
cc.mu.Unlock()
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
16
src/vendor/modules.txt
vendored
16
src/vendor/modules.txt
vendored
|
|
@ -1,13 +1,13 @@
|
||||||
# golang.org/x/crypto v0.41.0
|
# golang.org/x/crypto v0.42.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/crypto/chacha20
|
golang.org/x/crypto/chacha20
|
||||||
golang.org/x/crypto/chacha20poly1305
|
golang.org/x/crypto/chacha20poly1305
|
||||||
golang.org/x/crypto/cryptobyte
|
golang.org/x/crypto/cryptobyte
|
||||||
golang.org/x/crypto/cryptobyte/asn1
|
golang.org/x/crypto/cryptobyte/asn1
|
||||||
golang.org/x/crypto/internal/alias
|
golang.org/x/crypto/internal/alias
|
||||||
golang.org/x/crypto/internal/poly1305
|
golang.org/x/crypto/internal/poly1305
|
||||||
# golang.org/x/net v0.43.0
|
# golang.org/x/net v0.44.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/net/dns/dnsmessage
|
golang.org/x/net/dns/dnsmessage
|
||||||
golang.org/x/net/http/httpguts
|
golang.org/x/net/http/httpguts
|
||||||
golang.org/x/net/http/httpproxy
|
golang.org/x/net/http/httpproxy
|
||||||
|
|
@ -15,11 +15,11 @@ golang.org/x/net/http2/hpack
|
||||||
golang.org/x/net/idna
|
golang.org/x/net/idna
|
||||||
golang.org/x/net/lif
|
golang.org/x/net/lif
|
||||||
golang.org/x/net/nettest
|
golang.org/x/net/nettest
|
||||||
# golang.org/x/sys v0.35.0
|
# golang.org/x/sys v0.36.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/sys/cpu
|
golang.org/x/sys/cpu
|
||||||
# golang.org/x/text v0.28.0
|
# golang.org/x/text v0.29.0
|
||||||
## explicit; go 1.23.0
|
## explicit; go 1.24.0
|
||||||
golang.org/x/text/secure/bidirule
|
golang.org/x/text/secure/bidirule
|
||||||
golang.org/x/text/transform
|
golang.org/x/text/transform
|
||||||
golang.org/x/text/unicode/bidi
|
golang.org/x/text/unicode/bidi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue