net: add wasip1 support

For #58141

Co-authored-by: Richard Musiol <neelance@gmail.com>
Co-authored-by: Achille Roussel <achille.roussel@gmail.com>
Co-authored-by: Julien Fabre <ju.pryz@gmail.com>
Co-authored-by: Evan Phoenix <evan@phx.io>
Change-Id: I09a7cf33e43cb0e17ab3793c22cbad90b9e83b62
Reviewed-on: https://go-review.googlesource.com/c/go/+/479626
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Johan Brandhorst-Satzkorn 2023-03-25 16:57:07 -07:00 committed by Gopher Robot
parent eb2bc91976
commit ee591c8414
55 changed files with 58 additions and 57 deletions

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -5,7 +5,7 @@
// This file implements API tests across platforms and will never have a build
// tag.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
// DNS client: see RFC 1035.
// Has to be linked into package net for Dial.

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js && !windows
//go:build !js && !wasip1 && !windows
// Read system DNS config from /etc/resolv.conf

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || windows
//go:build unix || (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || js
//go:build unix || js || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build js && wasm
//go:build (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm)
//go:build unix || (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build js && wasm
//go:build (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || windows
//go:build unix || (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || windows
//go:build unix || (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js && !plan9
//go:build !js && !plan9 && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build js && wasm
//go:build (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js && !plan9
//go:build !js && !plan9 && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (js && wasm) || plan9
//go:build (js && wasm) || plan9 || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js && !plan9
//go:build !js && !plan9 && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Fake networking for js/wasm. It is intended to allow tests of other package to pass.
// Fake networking for js/wasm and wasip1/wasm. It is intended to allow tests of other package to pass.
//go:build js && wasm
//go:build (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -5,7 +5,7 @@
// This file implements API tests across platforms and will never have a build
// tag.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -12,9 +12,10 @@ import (
)
func TestReadLine(t *testing.T) {
// /etc/services file does not exist on android, plan9, windows.
// /etc/services file does not exist on android, plan9, windows, or wasip1
// where it would be required to be mounted from the host file system.
switch runtime.GOOS {
case "android", "plan9", "windows":
case "android", "plan9", "windows", "wasip1":
t.Skipf("not supported on %s", runtime.GOOS)
}
filename := "/etc/services" // a nice big file

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm)
//go:build unix || (js && wasm) || wasip1
// Read system port mappings from /etc/services

View File

@ -5,7 +5,7 @@
// This file implements API tests across platforms and will never have a build
// tag.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (js && wasm) || plan9
//go:build (js && wasm) || plan9 || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
// Test that Resolver.Dial can be a func returning an in-memory net.Conn
// speaking DNS.

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aix || (js && wasm) || netbsd || openbsd || ios
//go:build aix || (js && wasm) || netbsd || openbsd || ios || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build aix || (js && wasm) || solaris
//go:build aix || (js && wasm) || solaris || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || windows
//go:build unix || (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build js && wasm
//go:build (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build js && wasm
//go:build (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || windows
//go:build unix || (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js && !plan9 && !windows
//go:build !js && !plan9 && !wasip1 && !windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build js && wasm
//go:build (js && wasm) || wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || windows
//go:build unix || (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net

View File

@ -12,7 +12,7 @@ import (
"time"
)
// BUG(mikio): On JS and Plan 9, methods and functions related
// BUG(mikio): On JS, WASIP1 and Plan 9, methods and functions related
// to UnixConn and UnixListener are not implemented.
// BUG(mikio): On Windows, methods and functions related to UnixConn

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build unix || (js && wasm) || windows
//go:build unix || (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build (js && wasm) || windows
//go:build (js && wasm) || wasip1 || windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js && !plan9 && !windows
//go:build !js && !plan9 && !wasip1 && !windows
package net

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !js
//go:build !js && !wasip1
package net