refactor(netxlite): hide details without breaking the rest of the tree (#454)

## Description

This PR continues the refactoring of `netx` under the following principles:

1. do not break the rest of the tree and do not engage in extensive tree-wide refactoring yet
2. move under `netxlite` clearly related subpackages (e.g., `iox`, `netxmocks`)
3. move into `internal/netxlite/internal` stuff that is clearly private of `netxlite`
4. hide implementation details in `netxlite` pending new factories
5. refactor `tls` code in `netxlite` to clearly separate `crypto/tls` code from `utls` code

After each commit, I run `go test -short -race ./...` locally. Each individual commit explains what it does. I will squash, but this operation will preserve the original commit titles, so this will give further insight on each step.

## Commits

* refactor: rename netxmocks -> netxlite/mocks

Part of https://github.com/ooni/probe/issues/1591

* refactor: rename quicx -> netxlite/quicx

See https://github.com/ooni/probe/issues/1591

* refactor: rename iox -> netxlite/iox

Regenerate sources and make sure the tests pass.

See https://github.com/ooni/probe/issues/1591.

* refactor(iox): move MockableReader to netxlite/mocks

See https://github.com/ooni/probe/issues/1591

* refactor(netxlite): generator is an implementation detail

See https://github.com/ooni/probe/issues/1591

* refactor(netxlite): separate tls and utls code

See https://github.com/ooni/probe/issues/1591

* refactor(netxlite): hide most types but keep old names as legacy

With this change we avoid breaking the rest of the tree, but we start
hiding some implementation details a bit. Factories will follow.

See https://github.com/ooni/probe/issues/1591
This commit is contained in:
Simone Basso
2021-09-05 14:49:38 +02:00
committed by GitHub
parent ae799c4942
commit 2e0118d1a6
137 changed files with 1244 additions and 1173 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:55.967236 +0200 CEST m=+0.000374501
// 2021-09-05 13:54:18.962287 +0200 CEST m=+0.000333710
package ooapi
+2 -2
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:56.308361 +0200 CEST m=+0.000215751
// 2021-09-05 13:54:19.316964 +0200 CEST m=+0.000287376
package ooapi
@@ -17,7 +17,7 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/ooni/probe-cli/v3/internal/iox"
"github.com/ooni/probe-cli/v3/internal/netxlite/iox"
"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel"
)
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:56.587245 +0200 CEST m=+0.000218959
// 2021-09-05 13:54:19.664951 +0200 CEST m=+0.000206417
package ooapi
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:56.851681 +0200 CEST m=+0.000186126
// 2021-09-05 13:54:19.945161 +0200 CEST m=+0.000190709
package ooapi
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:57.174427 +0200 CEST m=+0.000217876
// 2021-09-05 13:54:20.211832 +0200 CEST m=+0.000215876
package ooapi
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:57.445485 +0200 CEST m=+0.000219751
// 2021-09-05 13:54:20.571825 +0200 CEST m=+0.000210710
package ooapi
+2 -2
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:57.708833 +0200 CEST m=+0.000193418
// 2021-09-05 13:54:20.84233 +0200 CEST m=+0.000203459
package ooapi
@@ -15,8 +15,8 @@ import (
"testing"
"github.com/google/go-cmp/cmp"
"github.com/ooni/probe-cli/v3/internal/iox"
"github.com/ooni/probe-cli/v3/internal/kvstore"
"github.com/ooni/probe-cli/v3/internal/netxlite/iox"
"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel"
)
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:57.987741 +0200 CEST m=+0.000211126
// 2021-09-05 13:54:21.153077 +0200 CEST m=+0.000199334
package ooapi
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"net/http"
"time"
"github.com/ooni/probe-cli/v3/internal/iox"
"github.com/ooni/probe-cli/v3/internal/netxlite/iox"
)
type FakeCodec struct {
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:58.234786 +0200 CEST m=+0.000218167
// 2021-09-05 13:54:21.412036 +0200 CEST m=+0.000169751
package ooapi
@@ -451,7 +451,7 @@ func GenAPIsTestGo(file string) {
fmt.Fprint(&sb, "\t\"sync\"\n")
fmt.Fprint(&sb, "\n")
fmt.Fprint(&sb, "\t\"github.com/google/go-cmp/cmp\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/iox\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/netxlite/iox\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel\"\n")
fmt.Fprint(&sb, ")\n")
for _, desc := range Descriptors {
@@ -168,7 +168,7 @@ func GenClientCallTestGo(file string) {
fmt.Fprint(&sb, "\t\"sync\"\n")
fmt.Fprint(&sb, "\n")
fmt.Fprint(&sb, "\t\"github.com/google/go-cmp/cmp\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/iox\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/netxlite/iox\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/kvstore\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel\"\n")
fmt.Fprint(&sb, ")\n")
@@ -71,7 +71,7 @@ func GenResponsesGo(file string) {
fmt.Fprint(&sb, "\t\"io\"\n")
fmt.Fprint(&sb, "\t\"net/http\"\n")
fmt.Fprint(&sb, "\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/iox\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/netxlite/iox\"\n")
fmt.Fprint(&sb, "\t\"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel\"\n")
fmt.Fprint(&sb, ")\n\n")
for _, desc := range Descriptors {
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:58.487888 +0200 CEST m=+0.000221710
// 2021-09-05 13:54:21.648163 +0200 CEST m=+0.000177959
package ooapi
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:58.755431 +0200 CEST m=+0.000217917
// 2021-09-05 13:54:21.967872 +0200 CEST m=+0.000174460
package ooapi
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"time"
"github.com/ooni/probe-cli/v3/internal/atomicx"
"github.com/ooni/probe-cli/v3/internal/iox"
"github.com/ooni/probe-cli/v3/internal/netxlite/iox"
"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel"
)
+1 -1
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:59.020364 +0200 CEST m=+0.000217085
// 2021-09-05 13:54:22.226116 +0200 CEST m=+0.000176793
package ooapi
+2 -2
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:59.329509 +0200 CEST m=+0.000220043
// 2021-09-05 13:54:22.556115 +0200 CEST m=+0.000158543
package ooapi
@@ -10,7 +10,7 @@ import (
"io"
"net/http"
"github.com/ooni/probe-cli/v3/internal/iox"
"github.com/ooni/probe-cli/v3/internal/netxlite/iox"
"github.com/ooni/probe-cli/v3/internal/ooapi/apimodel"
)
+2 -2
View File
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
// 2021-06-15 10:55:59.636856 +0200 CEST m=+0.000624459
// 2021-09-05 13:54:22.884854 +0200 CEST m=+0.000556501
package ooapi
@@ -9,7 +9,7 @@ const swagger = `{
"swagger": "2.0",
"info": {
"title": "OONI API specification",
"version": "0.20210615.6085559"
"version": "0.20210905.9115422"
},
"host": "api.ooni.io",
"basePath": "/",
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"github.com/hexops/gotextdiff"
"github.com/hexops/gotextdiff/myers"
"github.com/hexops/gotextdiff/span"
"github.com/ooni/probe-cli/v3/internal/iox"
"github.com/ooni/probe-cli/v3/internal/netxlite/iox"
"github.com/ooni/probe-cli/v3/internal/ooapi/internal/openapi"
)