From 2cd041481a3c432052c6d8b470f462597a136c31 Mon Sep 17 00:00:00 2001 From: Costin Manolache Date: Fri, 21 May 2021 14:32:37 -0700 Subject: [PATCH] More changes and fixes --- .github/workflows/go.yml | 6 +- .ko.yaml | 4 + .run/go-ugate.run.xml | 2 +- .run/push_ko.run.xml | 8 + .run/ugate-alice.run.xml | 16 + .run/ugate-bob.run.xml | 16 + .run/ugate-carol.run.xml | 14 + .run/ugate-gate.run.xml | 14 + .run/ugate-s1.run.xml | 14 + .run/ugate.run.xml | 6 + .run/ugate_Dockerfile.run.xml | 6 +- Dockerfile | 30 +- Makefile | 112 +++-- bin/ko-build.sh | 67 +++ cmd/hbone/hbone.go | 84 ++++ cmd/test.sh | 39 +- cmd/tun_setup.sh | 48 +- cmd/ugate/.ko.yaml | 4 + cmd/ugate/go.mod | 19 +- cmd/ugate/go.sum | 131 +++++ cmd/ugate/skaffold.yaml | 53 ++ cmd/ugate/testdata/alice/ugate.json | 18 + cmd/ugate/ugate_test.go | 7 +- cmd/ugatex/go.mod | 10 +- cmd/wp/wp.go | 466 +----------------- docs/dev.md | 106 ++++ docs/dns_sni.md | 51 ++ docs/oidc.md | 62 +++ docs/perf.md | 4 + ext/bootstrap/go.mod | 12 +- ext/bootstrapx/go.mod | 27 +- ext/{bootstrap => bootstrapx}/ugate_quiche.go | 2 +- ext/{bootstrap => bootstrapx}/ugate_webrtc.go | 2 +- ext/{bootstrap => bootstrapx}/ugate_xds.go | 2 +- ext/envoy/envoy.go | 17 + ext/envoy/envoy.yaml | 57 +++ ext/envoy/run.sh | 11 + ext/gvisor/go.mod | 4 +- ext/gvisor/tun_capture_gvisor.go | 16 +- ext/h2r/h2r.go | 2 +- ext/quic/go.mod | 7 +- ext/quic/go.sum | 2 - ext/quic/mux.go | 90 ++-- ext/quic/quic.go | 158 +++--- ext/ssh/ssh.go | 9 + manifests/Dockerfile.dbg | 73 --- manifests/{ugate/charts => }/hpa.yaml | 8 +- manifests/{cr.yaml => knative-ugate.yaml} | 7 + manifests/{ugate/charts => }/pdb.yaml | 10 +- manifests/ugate-dev/Chart.yaml | 8 + manifests/ugate-dev/templates/deployment.yaml | 94 ++++ manifests/ugate-dev/templates/pd.yaml | 10 + manifests/ugate-istio-system/Chart.yaml | 8 + .../templates/deployment.yaml | 89 ++++ manifests/ugate/Chart.yaml | 8 + manifests/ugate/charts/service.yaml | 16 - manifests/ugate/kustomization.yaml | 9 - manifests/ugate/lb-service.yaml | 17 + .../ugate/{charts => templates}/istio.yaml | 0 manifests/ugate/templates/service.yaml | 14 + .../app.yaml => templates/statefulset.yaml} | 151 +++--- manifests/ugate/values.yaml | 7 + pkg/auth/auth.go | 24 +- pkg/auth/bootstrap.go | 70 +++ pkg/auth/vapid.go | 10 + pkg/udp/udpproxy.go | 50 +- pkg/ugatesvc/accept.go | 140 +++++- pkg/ugatesvc/handlers.go | 36 +- pkg/ugatesvc/port_listener.go | 4 +- pkg/ugatesvc/routing.go | 27 +- pkg/ugatesvc/tls_conn.go | 8 +- pkg/ugatesvc/ugate.go | 73 ++- stream.go | 14 +- tools/dev/Dockerfile | 72 +++ tools/dev/dev.sh | 14 + tools/dev/run.sh | 48 ++ tools/dev/sshd_config | 27 + .../docker-compose.yaml | 0 tools/genkube.go | 21 + tools/jwtdecode.go | 61 +++ tools/vapid.go | 22 + tools/watcher.go | 298 +++++++++++ ugate.go | 2 +- 83 files changed, 2402 insertions(+), 983 deletions(-) create mode 100644 .ko.yaml create mode 100644 .run/push_ko.run.xml create mode 100644 .run/ugate-alice.run.xml create mode 100644 .run/ugate-bob.run.xml create mode 100644 .run/ugate-carol.run.xml create mode 100644 .run/ugate-gate.run.xml create mode 100644 .run/ugate-s1.run.xml create mode 100755 bin/ko-build.sh create mode 100644 cmd/hbone/hbone.go create mode 100644 cmd/ugate/.ko.yaml create mode 100644 cmd/ugate/skaffold.yaml create mode 100644 docs/dev.md create mode 100644 docs/dns_sni.md create mode 100644 docs/oidc.md rename ext/{bootstrap => bootstrapx}/ugate_quiche.go (91%) rename ext/{bootstrap => bootstrapx}/ugate_webrtc.go (94%) rename ext/{bootstrap => bootstrapx}/ugate_xds.go (97%) create mode 100644 ext/envoy/envoy.go create mode 100644 ext/envoy/envoy.yaml create mode 100644 ext/envoy/run.sh delete mode 100644 manifests/Dockerfile.dbg rename manifests/{ugate/charts => }/hpa.yaml (80%) rename manifests/{cr.yaml => knative-ugate.yaml} (68%) rename manifests/{ugate/charts => }/pdb.yaml (58%) create mode 100644 manifests/ugate-dev/Chart.yaml create mode 100644 manifests/ugate-dev/templates/deployment.yaml create mode 100644 manifests/ugate-dev/templates/pd.yaml create mode 100644 manifests/ugate-istio-system/Chart.yaml create mode 100644 manifests/ugate-istio-system/templates/deployment.yaml create mode 100644 manifests/ugate/Chart.yaml delete mode 100644 manifests/ugate/charts/service.yaml delete mode 100644 manifests/ugate/kustomization.yaml create mode 100644 manifests/ugate/lb-service.yaml rename manifests/ugate/{charts => templates}/istio.yaml (100%) create mode 100644 manifests/ugate/templates/service.yaml rename manifests/ugate/{charts/app.yaml => templates/statefulset.yaml} (52%) create mode 100644 manifests/ugate/values.yaml create mode 100644 pkg/auth/bootstrap.go create mode 100644 tools/dev/Dockerfile create mode 100644 tools/dev/dev.sh create mode 100755 tools/dev/run.sh create mode 100644 tools/dev/sshd_config rename docker-compose.yaml => tools/docker-compose.yaml (100%) create mode 100644 tools/genkube.go create mode 100644 tools/jwtdecode.go create mode 100644 tools/vapid.go create mode 100644 tools/watcher.go diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 922fdd3..3cfc0dd 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -24,10 +24,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Set up Go 1.14 + - name: Set up Go 1.16 uses: actions/setup-go@v1 with: - go-version: 1.14 + go-version: 1.16 id: go - name: Check out code into the Go module directory @@ -39,7 +39,7 @@ jobs: - name: Build run: | - go build -o ugate -v ./cmd/ugate + cd cmd/ugate && go build -o ../../ugate -v . - name: Upload ugate uses: actions/upload-artifact@v2 diff --git a/.ko.yaml b/.ko.yaml new file mode 100644 index 0000000..64bba94 --- /dev/null +++ b/.ko.yaml @@ -0,0 +1,4 @@ +#defaultBaseImage: docker.io/library/ubuntu:bionic + +defaultBaseImage: gcr.io/dmeshgate/ugate-dev:latest + diff --git a/.run/go-ugate.run.xml b/.run/go-ugate.run.xml index 793e8bb..afc5c03 100644 --- a/.run/go-ugate.run.xml +++ b/.run/go-ugate.run.xml @@ -8,7 +8,7 @@ - + diff --git a/.run/push_ko.run.xml b/.run/push_ko.run.xml new file mode 100644 index 0000000..7eb514d --- /dev/null +++ b/.run/push_ko.run.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.run/ugate-alice.run.xml b/.run/ugate-alice.run.xml new file mode 100644 index 0000000..c0ea592 --- /dev/null +++ b/.run/ugate-alice.run.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.run/ugate-bob.run.xml b/.run/ugate-bob.run.xml new file mode 100644 index 0000000..41f4d8a --- /dev/null +++ b/.run/ugate-bob.run.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.run/ugate-carol.run.xml b/.run/ugate-carol.run.xml new file mode 100644 index 0000000..639327a --- /dev/null +++ b/.run/ugate-carol.run.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.run/ugate-gate.run.xml b/.run/ugate-gate.run.xml new file mode 100644 index 0000000..492edb9 --- /dev/null +++ b/.run/ugate-gate.run.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.run/ugate-s1.run.xml b/.run/ugate-s1.run.xml new file mode 100644 index 0000000..3764101 --- /dev/null +++ b/.run/ugate-s1.run.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.run/ugate.run.xml b/.run/ugate.run.xml index 1b27a52..6630763 100644 --- a/.run/ugate.run.xml +++ b/.run/ugate.run.xml @@ -1,6 +1,7 @@ @@ -17,6 +18,9 @@ + \ No newline at end of file diff --git a/.run/ugate_Dockerfile.run.xml b/.run/ugate_Dockerfile.run.xml index ab066d3..73aa650 100644 --- a/.run/ugate_Dockerfile.run.xml +++ b/.run/ugate_Dockerfile.run.xml @@ -2,11 +2,9 @@ -