diff --git a/internal/engine/session_psiphon.go b/internal/engine/session_psiphon.go index 4e374e6..bb2a0d4 100644 --- a/internal/engine/session_psiphon.go +++ b/internal/engine/session_psiphon.go @@ -9,7 +9,7 @@ import ( _ "embed" "filippo.io/age" - "github.com/ooni/probe-cli/v3/internal/netxlite/iox" + "github.com/ooni/probe-cli/v3/internal/netxlite" ) //go:embed psiphon-config.json.age @@ -35,7 +35,7 @@ func (s *sessionTunnelEarlySession) FetchPsiphonConfig(ctx context.Context) ([]b if err != nil { return nil, err } - return iox.ReadAllContext(ctx, output) + return netxlite.ReadAllContext(ctx, output) } // FetchPsiphonConfig decrypts psiphonConfigJSONAge using diff --git a/internal/netxlite/certifi.go b/internal/netxlite/certifi.go index d2b5af9..afcdcd0 100644 --- a/internal/netxlite/certifi.go +++ b/internal/netxlite/certifi.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// 2021-09-28 12:05:19.526032 +0200 CEST m=+0.405934084 +// 2021-09-28 18:13:53.557509 +0200 CEST m=+0.459759459 // https://curl.haxx.se/ca/cacert.pem package netxlite diff --git a/internal/netxlite/errno.go b/internal/netxlite/errno.go index e5f9249..750de6e 100644 --- a/internal/netxlite/errno.go +++ b/internal/netxlite/errno.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Generated: 2021-09-28 12:05:19.868647 +0200 CEST m=+0.105301959 +// Generated: 2021-09-28 18:13:54.361886 +0200 CEST m=+0.453564501 package netxlite @@ -16,7 +16,6 @@ const ( // // System errors // - FailureOperationCanceled = "operation_canceled" FailureConnectionRefused = "connection_refused" FailureConnectionReset = "connection_reset" FailureHostUnreachable = "host_unreachable" @@ -67,7 +66,6 @@ const ( // failureMap lists all failures so we can match them // when they are wrapped by quic.TransportError. var failuresMap = map[string]string{ - "operation_canceled": "operation_canceled", "connection_refused": "connection_refused", "connection_reset": "connection_reset", "host_unreachable": "host_unreachable", @@ -120,8 +118,6 @@ func classifySyscallError(err error) string { return "" } switch errno { - case ECANCELED: - return FailureOperationCanceled case ECONNREFUSED: return FailureConnectionRefused case ECONNRESET: diff --git a/internal/netxlite/errno_unix.go b/internal/netxlite/errno_android.go similarity index 91% rename from internal/netxlite/errno_unix.go rename to internal/netxlite/errno_android.go index 82f3004..a4eec36 100644 --- a/internal/netxlite/errno_unix.go +++ b/internal/netxlite/errno_android.go @@ -1,12 +1,11 @@ // Code generated by go generate; DO NOT EDIT. -// Generated: 2021-09-28 12:05:19.763535 +0200 CEST m=+0.000187668 +// Generated: 2021-09-28 18:13:53.909532 +0200 CEST m=+0.001205084 package netxlite import "golang.org/x/sys/unix" const ( - ECANCELED = unix.ECANCELED ECONNREFUSED = unix.ECONNREFUSED ECONNRESET = unix.ECONNRESET EHOSTUNREACH = unix.EHOSTUNREACH diff --git a/internal/netxlite/errno_darwin.go b/internal/netxlite/errno_darwin.go new file mode 100644 index 0000000..eca953d --- /dev/null +++ b/internal/netxlite/errno_darwin.go @@ -0,0 +1,36 @@ +// Code generated by go generate; DO NOT EDIT. +// Generated: 2021-09-28 18:13:54.015321 +0200 CEST m=+0.106996042 + +package netxlite + +import "golang.org/x/sys/unix" + +const ( + ECONNREFUSED = unix.ECONNREFUSED + ECONNRESET = unix.ECONNRESET + EHOSTUNREACH = unix.EHOSTUNREACH + ETIMEDOUT = unix.ETIMEDOUT + EAFNOSUPPORT = unix.EAFNOSUPPORT + EADDRINUSE = unix.EADDRINUSE + EADDRNOTAVAIL = unix.EADDRNOTAVAIL + EISCONN = unix.EISCONN + EFAULT = unix.EFAULT + EBADF = unix.EBADF + ECONNABORTED = unix.ECONNABORTED + EALREADY = unix.EALREADY + EDESTADDRREQ = unix.EDESTADDRREQ + EINTR = unix.EINTR + EINVAL = unix.EINVAL + EMSGSIZE = unix.EMSGSIZE + ENETDOWN = unix.ENETDOWN + ENETRESET = unix.ENETRESET + ENETUNREACH = unix.ENETUNREACH + ENOBUFS = unix.ENOBUFS + ENOPROTOOPT = unix.ENOPROTOOPT + ENOTSOCK = unix.ENOTSOCK + ENOTCONN = unix.ENOTCONN + EWOULDBLOCK = unix.EWOULDBLOCK + EACCES = unix.EACCES + EPROTONOSUPPORT = unix.EPROTONOSUPPORT + EPROTOTYPE = unix.EPROTOTYPE +) diff --git a/internal/netxlite/errno_freebsd.go b/internal/netxlite/errno_freebsd.go new file mode 100644 index 0000000..c52b2af --- /dev/null +++ b/internal/netxlite/errno_freebsd.go @@ -0,0 +1,36 @@ +// Code generated by go generate; DO NOT EDIT. +// Generated: 2021-09-28 18:13:54.08291 +0200 CEST m=+0.174585667 + +package netxlite + +import "golang.org/x/sys/unix" + +const ( + ECONNREFUSED = unix.ECONNREFUSED + ECONNRESET = unix.ECONNRESET + EHOSTUNREACH = unix.EHOSTUNREACH + ETIMEDOUT = unix.ETIMEDOUT + EAFNOSUPPORT = unix.EAFNOSUPPORT + EADDRINUSE = unix.EADDRINUSE + EADDRNOTAVAIL = unix.EADDRNOTAVAIL + EISCONN = unix.EISCONN + EFAULT = unix.EFAULT + EBADF = unix.EBADF + ECONNABORTED = unix.ECONNABORTED + EALREADY = unix.EALREADY + EDESTADDRREQ = unix.EDESTADDRREQ + EINTR = unix.EINTR + EINVAL = unix.EINVAL + EMSGSIZE = unix.EMSGSIZE + ENETDOWN = unix.ENETDOWN + ENETRESET = unix.ENETRESET + ENETUNREACH = unix.ENETUNREACH + ENOBUFS = unix.ENOBUFS + ENOPROTOOPT = unix.ENOPROTOOPT + ENOTSOCK = unix.ENOTSOCK + ENOTCONN = unix.ENOTCONN + EWOULDBLOCK = unix.EWOULDBLOCK + EACCES = unix.EACCES + EPROTONOSUPPORT = unix.EPROTONOSUPPORT + EPROTOTYPE = unix.EPROTOTYPE +) diff --git a/internal/netxlite/errno_ios.go b/internal/netxlite/errno_ios.go new file mode 100644 index 0000000..a65a10a --- /dev/null +++ b/internal/netxlite/errno_ios.go @@ -0,0 +1,36 @@ +// Code generated by go generate; DO NOT EDIT. +// Generated: 2021-09-28 18:13:54.151936 +0200 CEST m=+0.243612834 + +package netxlite + +import "golang.org/x/sys/unix" + +const ( + ECONNREFUSED = unix.ECONNREFUSED + ECONNRESET = unix.ECONNRESET + EHOSTUNREACH = unix.EHOSTUNREACH + ETIMEDOUT = unix.ETIMEDOUT + EAFNOSUPPORT = unix.EAFNOSUPPORT + EADDRINUSE = unix.EADDRINUSE + EADDRNOTAVAIL = unix.EADDRNOTAVAIL + EISCONN = unix.EISCONN + EFAULT = unix.EFAULT + EBADF = unix.EBADF + ECONNABORTED = unix.ECONNABORTED + EALREADY = unix.EALREADY + EDESTADDRREQ = unix.EDESTADDRREQ + EINTR = unix.EINTR + EINVAL = unix.EINVAL + EMSGSIZE = unix.EMSGSIZE + ENETDOWN = unix.ENETDOWN + ENETRESET = unix.ENETRESET + ENETUNREACH = unix.ENETUNREACH + ENOBUFS = unix.ENOBUFS + ENOPROTOOPT = unix.ENOPROTOOPT + ENOTSOCK = unix.ENOTSOCK + ENOTCONN = unix.ENOTCONN + EWOULDBLOCK = unix.EWOULDBLOCK + EACCES = unix.EACCES + EPROTONOSUPPORT = unix.EPROTONOSUPPORT + EPROTOTYPE = unix.EPROTOTYPE +) diff --git a/internal/netxlite/errno_linux.go b/internal/netxlite/errno_linux.go new file mode 100644 index 0000000..1329c08 --- /dev/null +++ b/internal/netxlite/errno_linux.go @@ -0,0 +1,36 @@ +// Code generated by go generate; DO NOT EDIT. +// Generated: 2021-09-28 18:13:54.230156 +0200 CEST m=+0.321833417 + +package netxlite + +import "golang.org/x/sys/unix" + +const ( + ECONNREFUSED = unix.ECONNREFUSED + ECONNRESET = unix.ECONNRESET + EHOSTUNREACH = unix.EHOSTUNREACH + ETIMEDOUT = unix.ETIMEDOUT + EAFNOSUPPORT = unix.EAFNOSUPPORT + EADDRINUSE = unix.EADDRINUSE + EADDRNOTAVAIL = unix.EADDRNOTAVAIL + EISCONN = unix.EISCONN + EFAULT = unix.EFAULT + EBADF = unix.EBADF + ECONNABORTED = unix.ECONNABORTED + EALREADY = unix.EALREADY + EDESTADDRREQ = unix.EDESTADDRREQ + EINTR = unix.EINTR + EINVAL = unix.EINVAL + EMSGSIZE = unix.EMSGSIZE + ENETDOWN = unix.ENETDOWN + ENETRESET = unix.ENETRESET + ENETUNREACH = unix.ENETUNREACH + ENOBUFS = unix.ENOBUFS + ENOPROTOOPT = unix.ENOPROTOOPT + ENOTSOCK = unix.ENOTSOCK + ENOTCONN = unix.ENOTCONN + EWOULDBLOCK = unix.EWOULDBLOCK + EACCES = unix.EACCES + EPROTONOSUPPORT = unix.EPROTONOSUPPORT + EPROTOTYPE = unix.EPROTOTYPE +) diff --git a/internal/netxlite/errno_test.go b/internal/netxlite/errno_test.go index b60b35a..79a8b04 100644 --- a/internal/netxlite/errno_test.go +++ b/internal/netxlite/errno_test.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Generated: 2021-09-28 12:05:19.918073 +0200 CEST m=+0.154728959 +// Generated: 2021-09-28 18:13:54.431042 +0200 CEST m=+0.522721376 package netxlite @@ -16,12 +16,6 @@ func TestClassifySyscallError(t *testing.T) { } }) - t.Run("for ECANCELED", func(t *testing.T) { - if v := classifySyscallError(ECANCELED); v != FailureOperationCanceled { - t.Fatalf("expected '%s', got '%s'", FailureOperationCanceled, v) - } - }) - t.Run("for ECONNREFUSED", func(t *testing.T) { if v := classifySyscallError(ECONNREFUSED); v != FailureConnectionRefused { t.Fatalf("expected '%s', got '%s'", FailureConnectionRefused, v) diff --git a/internal/netxlite/errno_windows.go b/internal/netxlite/errno_windows.go index a20a9bd..faa31f0 100644 --- a/internal/netxlite/errno_windows.go +++ b/internal/netxlite/errno_windows.go @@ -1,37 +1,36 @@ // Code generated by go generate; DO NOT EDIT. -// Generated: 2021-09-28 12:05:19.843209 +0200 CEST m=+0.079863168 +// Generated: 2021-09-28 18:13:54.317744 +0200 CEST m=+0.409422292 package netxlite import "golang.org/x/sys/windows" const ( - ECANCELED = windows.ECANCELED - ECONNREFUSED = windows.ECONNREFUSED - ECONNRESET = windows.ECONNRESET - EHOSTUNREACH = windows.EHOSTUNREACH - ETIMEDOUT = windows.ETIMEDOUT - EAFNOSUPPORT = windows.EAFNOSUPPORT - EADDRINUSE = windows.EADDRINUSE - EADDRNOTAVAIL = windows.EADDRNOTAVAIL - EISCONN = windows.EISCONN - EFAULT = windows.EFAULT - EBADF = windows.EBADF - ECONNABORTED = windows.ECONNABORTED - EALREADY = windows.EALREADY - EDESTADDRREQ = windows.EDESTADDRREQ - EINTR = windows.EINTR - EINVAL = windows.EINVAL - EMSGSIZE = windows.EMSGSIZE - ENETDOWN = windows.ENETDOWN - ENETRESET = windows.ENETRESET - ENETUNREACH = windows.ENETUNREACH - ENOBUFS = windows.ENOBUFS - ENOPROTOOPT = windows.ENOPROTOOPT - ENOTSOCK = windows.ENOTSOCK - ENOTCONN = windows.ENOTCONN - EWOULDBLOCK = windows.EWOULDBLOCK - EACCES = windows.EACCES - EPROTONOSUPPORT = windows.EPROTONOSUPPORT - EPROTOTYPE = windows.EPROTOTYPE + ECONNREFUSED = windows.WSAECONNREFUSED + ECONNRESET = windows.WSAECONNRESET + EHOSTUNREACH = windows.WSAEHOSTUNREACH + ETIMEDOUT = windows.WSAETIMEDOUT + EAFNOSUPPORT = windows.WSAEAFNOSUPPORT + EADDRINUSE = windows.WSAEADDRINUSE + EADDRNOTAVAIL = windows.WSAEADDRNOTAVAIL + EISCONN = windows.WSAEISCONN + EFAULT = windows.WSAEFAULT + EBADF = windows.WSAEBADF + ECONNABORTED = windows.WSAECONNABORTED + EALREADY = windows.WSAEALREADY + EDESTADDRREQ = windows.WSAEDESTADDRREQ + EINTR = windows.WSAEINTR + EINVAL = windows.WSAEINVAL + EMSGSIZE = windows.WSAEMSGSIZE + ENETDOWN = windows.WSAENETDOWN + ENETRESET = windows.WSAENETRESET + ENETUNREACH = windows.WSAENETUNREACH + ENOBUFS = windows.WSAENOBUFS + ENOPROTOOPT = windows.WSAENOPROTOOPT + ENOTSOCK = windows.WSAENOTSOCK + ENOTCONN = windows.WSAENOTCONN + EWOULDBLOCK = windows.WSAEWOULDBLOCK + EACCES = windows.WSAEACCES + EPROTONOSUPPORT = windows.WSAEPROTONOSUPPORT + EPROTOTYPE = windows.WSAEPROTOTYPE ) diff --git a/internal/netxlite/internal/generrno/main.go b/internal/netxlite/internal/generrno/main.go index a93ab33..e5c2675 100644 --- a/internal/netxlite/internal/generrno/main.go +++ b/internal/netxlite/internal/generrno/main.go @@ -59,7 +59,6 @@ func (es *ErrorSpec) IsSystemError() bool { // Specs contains all the error specs. var Specs = []*ErrorSpec{ - NewSystemError("ECANCELED", "operation_canceled"), NewSystemError("ECONNREFUSED", "connection_refused"), NewSystemError("ECONNRESET", "connection_reset"), NewSystemError("EHOSTUNREACH", "host_unreachable"), @@ -138,20 +137,20 @@ func gofmt(filename string) { } } -func writeSystemSpecificFile(kind string) { +func writeSystemSpecificFile(kind, library, prefix string) { filename := "errno_" + kind + ".go" filep := fileCreate(filename) fileWrite(filep, "// Code generated by go generate; DO NOT EDIT.\n") filePrintf(filep, "// Generated: %+v\n\n", time.Now()) fileWrite(filep, "package netxlite\n\n") - filePrintf(filep, "import \"golang.org/x/sys/%s\"\n\n", kind) + filePrintf(filep, "import \"golang.org/x/sys/%s\"\n\n", library) fileWrite(filep, "const (\n") for _, spec := range Specs { if !spec.IsSystemError() { continue } - filePrintf(filep, "\t%s = %s.%s\n", - spec.AsErrnoName(), kind, spec.AsErrnoName()) + filePrintf(filep, "\t%s = %s.%s%s\n", + spec.AsErrnoName(), library, prefix, spec.AsErrnoName()) } fileWrite(filep, ")\n\n") fileClose(filep) @@ -277,8 +276,12 @@ func writeGenericTestFile() { } func main() { - writeSystemSpecificFile("unix") - writeSystemSpecificFile("windows") + writeSystemSpecificFile("android", "unix", "") + writeSystemSpecificFile("darwin", "unix", "") + writeSystemSpecificFile("freebsd", "unix", "") + writeSystemSpecificFile("ios", "unix", "") + writeSystemSpecificFile("linux", "unix", "") + writeSystemSpecificFile("windows", "windows", "WSA") writeGenericFile() writeGenericTestFile() }