TUN-6917: Bump go to 1.19.3

This commit is contained in:
Devin Carr 2022-11-04 16:39:42 -07:00
parent 1b5313cc28
commit 515ad7cbee
13 changed files with 76 additions and 70 deletions

View File

@ -297,8 +297,8 @@ quic-deps:
.PHONY: vet .PHONY: vet
vet: vet:
go vet -v -mod=vendor ./... go vet -v -mod=vendor github.com/cloudflare/cloudflared/...
.PHONY: goimports .PHONY: fmt
goimports: fmt:
for d in $$(go list -mod=readonly -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc) ; do goimports -format-only -local github.com/cloudflare/cloudflared -w $$d ; done goimports -l -w -local github.com/cloudflare/cloudflared $$(go list -mod=vendor -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc)

View File

@ -1,6 +1,6 @@
//Package carrier provides a WebSocket proxy to carry or proxy a connection // Package carrier provides a WebSocket proxy to carry or proxy a connection
//from the local client to the edge. See it as a wrapper around any protocol // from the local client to the edge. See it as a wrapper around any protocol
//that it packages up in a WebSocket connection to the edge. // that it packages up in a WebSocket connection to the edge.
package carrier package carrier
import ( import (

View File

@ -1,23 +1,29 @@
pinned_go: &pinned_go go=1.18.6-1 pinned_go: &pinned_go go=1.19.3-1
pinned_go_fips: &pinned_go_fips go-boring=1.18.6-1 pinned_go_fips: &pinned_go_fips go-boring=1.19.3-1
build_dir: &build_dir /cfsetup_build build_dir: &build_dir /cfsetup_build
default-flavor: bullseye default-flavor: bullseye
stretch: &stretch stretch: &stretch
build: build:
build_dir: *build_dir build_dir: *build_dir
builddeps: builddeps: &build_deps
- *pinned_go - *pinned_go
- build-essential - build-essential
- gotest-to-teamcity
pre-cache: &build_pre_cache
- export GOCACHE=/cfsetup_build/.cache/go-build
- go install golang.org/x/tools/cmd/goimports@latest
post-cache: post-cache:
- export GOOS=linux - export GOOS=linux
- export GOARCH=amd64 - export GOARCH=amd64
- make cloudflared - make cloudflared
build-fips: build-fips:
build_dir: *build_dir build_dir: *build_dir
builddeps: builddeps: &build_deps_fips
- *pinned_go_fips - *pinned_go_fips
- build-essential - build-essential
- gotest-to-teamcity
pre-cache: *build_pre_cache
post-cache: post-cache:
- export GOOS=linux - export GOOS=linux
- export GOARCH=amd64 - export GOARCH=amd64
@ -163,12 +169,8 @@ stretch: &stretch
- make github-windows-upload - make github-windows-upload
test: test:
build_dir: *build_dir build_dir: *build_dir
builddeps: builddeps: *build_deps
- *pinned_go pre-cache: *build_pre_cache
- build-essential
- gotest-to-teamcity
pre-cache: &test_pre_cache
- go install golang.org/x/tools/cmd/goimports@latest
post-cache: post-cache:
- export GOOS=linux - export GOOS=linux
- export GOARCH=amd64 - export GOARCH=amd64
@ -177,11 +179,8 @@ stretch: &stretch
- make test | gotest-to-teamcity - make test | gotest-to-teamcity
test-fips: test-fips:
build_dir: *build_dir build_dir: *build_dir
builddeps: builddeps: *build_deps_fips
- *pinned_go_fips pre-cache: *build_pre_cache
- build-essential
- gotest-to-teamcity
pre-cache: *test_pre_cache
post-cache: post-cache:
- export GOOS=linux - export GOOS=linux
- export GOARCH=amd64 - export GOARCH=amd64

View File

@ -1,4 +1,4 @@
FROM golang:1.18 as builder FROM golang:1.19 as builder
ENV GO111MODULE=on \ ENV GO111MODULE=on \
CGO_ENABLED=0 CGO_ENABLED=0
WORKDIR /go/src/github.com/cloudflare/cloudflared/ WORKDIR /go/src/github.com/cloudflare/cloudflared/

View File

@ -73,9 +73,12 @@ type EdgeAddr struct {
// Note: Instead of DoT, we could also have used DoH. Either of these: // Note: Instead of DoT, we could also have used DoH. Either of these:
// - directly via the JSON API (https://1.1.1.1/dns-query?ct=application/dns-json&name=_origintunneld._tcp.argotunnel.com&type=srv) // - directly via the JSON API (https://1.1.1.1/dns-query?ct=application/dns-json&name=_origintunneld._tcp.argotunnel.com&type=srv)
// - indirectly via `tunneldns.NewUpstreamHTTPS()` // - indirectly via `tunneldns.NewUpstreamHTTPS()`
//
// But both of these cases miss out on a key feature from the stdlib: // But both of these cases miss out on a key feature from the stdlib:
//
// "The returned records are sorted by priority and randomized by weight within a priority." // "The returned records are sorted by priority and randomized by weight within a priority."
// (https://golang.org/pkg/net/#Resolver.LookupSRV) // (https://golang.org/pkg/net/#Resolver.LookupSRV)
//
// Does this matter? I don't know. It may someday. Let's use DoT so we don't need to worry about it. // Does this matter? I don't know. It may someday. Let's use DoT so we don't need to worry about it.
// See also: Go feature request for stdlib-supported DoH: https://github.com/golang/go/issues/27552 // See also: Go feature request for stdlib-supported DoH: https://github.com/golang/go/issues/27552
var fallbackLookupSRV = lookupSRVWithDOT var fallbackLookupSRV = lookupSRVWithDOT

View File

@ -2,12 +2,12 @@
set -e -o pipefail set -e -o pipefail
OUTPUT=$(for d in $(go list -mod=vendor -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc) ; do goimports -format-only -local github.com/cloudflare/cloudflared -d $d ; done) OUTPUT=$(goimports -l -d -local github.com/cloudflare/cloudflared $(go list -mod=vendor -f '{{.Dir}}' -a ./... | fgrep -v tunnelrpc))
if [ -n "$OUTPUT" ] ; then if [ -n "$OUTPUT" ] ; then
PAGER=$(which colordiff || echo cat) PAGER=$(which colordiff || echo cat)
echo echo
echo "Code formatting issues found, use 'goimports -format-only -local github.com/cloudflare/cloudflared' to correct them" echo "Code formatting issues found, use 'make fmt' to correct them"
echo echo
echo "$OUTPUT" | $PAGER echo "$OUTPUT" | $PAGER
exit 1 exit 1

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/cloudflare/cloudflared module github.com/cloudflare/cloudflared
go 1.18 go 1.19
require ( require (
github.com/cloudflare/brotli-go v0.0.0-20191101163834-d34379f7ff93 github.com/cloudflare/brotli-go v0.0.0-20191101163834-d34379f7ff93

View File

@ -439,6 +439,7 @@ func (defaults *OriginRequestConfig) setAccess(overrides config.OriginRequestCon
// 2. The user config for the overall ingress config // 2. The user config for the overall ingress config
// 3. Defaults chosen by the cloudflared team // 3. Defaults chosen by the cloudflared team
// 4. Golang zero values for that type // 4. Golang zero values for that type
//
// If an earlier option isn't set, it will try the next option down. // If an earlier option isn't set, it will try the next option down.
func setConfig(defaults OriginRequestConfig, overrides config.OriginRequestConfig) OriginRequestConfig { func setConfig(defaults OriginRequestConfig, overrides config.OriginRequestConfig) OriginRequestConfig {
cfg := defaults cfg := defaults

View File

@ -376,20 +376,20 @@ func (ip *icmpProxy) icmpEchoRoundtrip(dst netip.Addr, echo *icmp.Echo) (echoRes
} }
/* /*
Wrapper to call https://docs.microsoft.com/en-us/windows/win32/api/icmpapi/nf-icmpapi-icmpsendecho Wrapper to call https://docs.microsoft.com/en-us/windows/win32/api/icmpapi/nf-icmpapi-icmpsendecho
Parameters: Parameters:
- IcmpHandle: Handle created by IcmpCreateFile - IcmpHandle: Handle created by IcmpCreateFile
- DestinationAddress: IPv4 in the form of https://docs.microsoft.com/en-us/windows/win32/api/inaddr/ns-inaddr-in_addr#syntax - DestinationAddress: IPv4 in the form of https://docs.microsoft.com/en-us/windows/win32/api/inaddr/ns-inaddr-in_addr#syntax
- RequestData: A pointer to echo data - RequestData: A pointer to echo data
- RequestSize: Number of bytes in buffer pointed by echo data - RequestSize: Number of bytes in buffer pointed by echo data
- RequestOptions: IP header options - RequestOptions: IP header options
- ReplyBuffer: A pointer to the buffer for echoReply, options and data - ReplyBuffer: A pointer to the buffer for echoReply, options and data
- ReplySize: Number of bytes allocated for ReplyBuffer - ReplySize: Number of bytes allocated for ReplyBuffer
- Timeout: Timeout in milliseconds to wait for a reply - Timeout: Timeout in milliseconds to wait for a reply
Returns: Returns:
- the number of replies in uint32 https://docs.microsoft.com/en-us/windows/win32/api/icmpapi/nf-icmpapi-icmpsendecho#return-value - the number of replies in uint32 https://docs.microsoft.com/en-us/windows/win32/api/icmpapi/nf-icmpapi-icmpsendecho#return-value
To retain the reference allocated objects, conversion from pointer to uintptr must happen as arguments to the To retain the reference allocated objects, conversion from pointer to uintptr must happen as arguments to the
syscall function syscall function
*/ */
func (ip *icmpProxy) icmpSendEcho(dst netip.Addr, echo *icmp.Echo) (*echoV4Resp, error) { func (ip *icmpProxy) icmpSendEcho(dst netip.Addr, echo *icmp.Echo) (*echoV4Resp, error) {
dataSize := len(echo.Data) dataSize := len(echo.Data)

View File

@ -40,7 +40,6 @@ func (ar AuthenticateResponse) Outcome() AuthOutcome {
} }
// AuthOutcome is a programmer-friendly sum type denoting the possible outcomes of Authenticate. // AuthOutcome is a programmer-friendly sum type denoting the possible outcomes of Authenticate.
//go-sumtype:decl AuthOutcome
type AuthOutcome interface { type AuthOutcome interface {
isAuthOutcome() isAuthOutcome()
// Serialize into an AuthenticateResponse which can be sent via Capnp // Serialize into an AuthenticateResponse which can be sent via Capnp

View File

@ -61,9 +61,13 @@ func ValidateHostname(hostname string) (string, error) {
// ValidateUrl returns a validated version of `originUrl` with a scheme prepended (by default http://). // ValidateUrl returns a validated version of `originUrl` with a scheme prepended (by default http://).
// Note: when originUrl contains a scheme, the path is removed: // Note: when originUrl contains a scheme, the path is removed:
//
// ValidateUrl("https://localhost:8080/api/") => "https://localhost:8080" // ValidateUrl("https://localhost:8080/api/") => "https://localhost:8080"
//
// but when it does not, the path is preserved: // but when it does not, the path is preserved:
//
// ValidateUrl("localhost:8080/api/") => "http://localhost:8080/api/" // ValidateUrl("localhost:8080/api/") => "http://localhost:8080/api/"
//
// This is arguably a bug, but changing it might break some cloudflared users. // This is arguably a bug, but changing it might break some cloudflared users.
func ValidateUrl(originUrl string) (*url.URL, error) { func ValidateUrl(originUrl string) (*url.URL, error) {
urlStr, err := validateUrlString(originUrl) urlStr, err := validateUrlString(originUrl)