Skip to content

Commit

Permalink
Incremental work
Browse files Browse the repository at this point in the history
  • Loading branch information
costinm committed Jun 14, 2022
1 parent 2196d86 commit cafcfb6
Show file tree
Hide file tree
Showing 179 changed files with 82,214 additions and 1,133 deletions.
45 changes: 1 addition & 44 deletions .run/ugate.run.xml
Original file line number Diff line number Diff line change
@@ -1,46 +1,3 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ugate" type="CloudCodeCloudRunConfigurationType" factoryName="CloudCodeCloudDeployRunConfigurationFactory" show_console_on_std_err="false" show_console_on_std_out="false" gcpProject="{&quot;googleUsername&quot;:&quot;[email protected]&quot;,&quot;projectId&quot;:&quot;dmeshgate&quot;,&quot;projectName&quot;:&quot;dmeshgate&quot;,&quot;projectNumber&quot;:584624515903}" imageBuilder="{&quot;name&quot;:&quot;Docker&quot;,&quot;payload&quot;:{&quot;path&quot;:&quot;Dockerfile&quot;}}">
<option name="allowRunningInParallel" value="false" />
<option name="buildEnvironment" value="Local" />
<option name="buildpacksEnv">
<map />
</option>
<option name="cloudSqlConnections">
<list />
</option>
<option name="concurrency" value="1000" />
<option name="cpuAllocated" value="1" />
<option name="customCpuAllocated" value="" />
<option name="dockerBuildArgs">
<map />
</option>
<option name="dockerTarget" value="" />
<option name="environmentVariables">
<map />
</option>
<option name="gcbSettings">
<GoogleCloudBuildSettings />
</option>
<option name="gkeClusterLocation" />
<option name="gkeClusterName" />
<option name="gkeClusterNamespace" value="default" />
<option name="gkeConnectivity" value="EXTERNAL" />
<option name="imagePath" value="gcr.io/dmeshgate/ugate" />
<option name="loadingAvailableBuilders" value="false" />
<option name="managedAuthentication" value="ALLOW_UNAUTHENTICATED" />
<option name="managedRegion" value="us-central1" />
<option name="maxInstances" value="1" />
<option name="memoryAllocated" value="MIB_256" />
<option name="minInstances" value="" />
<option name="platform" value="FULLY_MANAGED" />
<option name="projectPathOnTarget" />
<option name="selectedOptions">
<list />
</option>
<option name="serviceAccount" value="" />
<option name="serviceName" value="ugate" />
<option name="timeout" value="900" />
<option name="vpcConnector" value="" />
<method v="2" />
</configuration>
<configuration />
</component>
21 changes: 16 additions & 5 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,34 @@

## Streams with metadata

The 'stream' is modeled after [H2 and H3](https://httpwg.org/specs/rfc7540.html#StreamsLayer).
In go, this is modeled as a net.Conn interface - extended with metadata.

Like Istio, this library is based on 'enhanced' L4 streams, i.e. mostly opaque streams
with added identity, security and metadata. HTTP requests are also mapped to streams,
so all communication is handled in an uniform way.
so all communication is handled in an uniform way. uGate was designed around a messaging
model - messages are also modeled as streams.

## Circuits and reverse accept
## Messaging/pubsub

Similar with SSH, Tor, IPFS, WebRTC, etc this allows nodes behind NAT and without
server ports to listen and accept streams originated from other nodes.
The original project ( wpgate ) goal was to implement a distributed/federated Webpush
messaging infrastructure, to support a disconnected, ad-hoc communication (dmesh).

## Messaging/pubsub
Secure messaging and webpush remain at the core of uGate project.

WIP. The 'control plane' portion is based on Istio XDS, but extended with the proposed
'messaging' extensions.

Messages can also be transmitted as Webpush - i.e. encrypted, authenticated - so
XDS proxies can't see or modify control messages.

## Associations, Circuits and reverse accept


Similar with SSH, Tor, IPFS, WebRTC, etc this allows nodes behind NAT and without
server ports to listen and accept streams and messages originated from other nodes.


# Code organization

## github.com/costinm/ugate
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,17 @@ remote/_run: build
update:
# yq -j < cmd/ugate/testdata/ugate.yaml > cmd/ugate/testdata/ugate.json


deps:
go install github.com/bufbuild/buf/cmd/buf@latest
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install github.com/bufbuild/connect-go/cmd/protoc-gen-connect-go@latest

# debug tool for std grpc - need http/tcp equivalent
go install -v github.com/grpc-ecosystem/grpcdebug@latest
# Test tool
go install github.com/bojand/ghz/cmd/ghz@latest

proto-gen:
cd proto && buf generate
1 change: 1 addition & 0 deletions cmd/ugate/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ replace github.com/costinm/ugate => ../../
replace github.com/costinm/ugate/dns => ../../dns

replace github.com/costinm/ugate/ext/bootstrap => ../../ext/bootstrap
replace github.com/costinm/ugate/ext/bootstrapx => ../../ext/bootstrapx

replace github.com/costinm/ugate/ext/quic => ../../ext/quic

Expand Down
5 changes: 5 additions & 0 deletions cmd/ugate/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl
dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4=
dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999 h1:OR8VhtwhcAI3U48/rzBsVOuHi0zDPzYI1xASVcdSgR8=
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
Expand Down Expand Up @@ -48,6 +49,7 @@ github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200j
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -92,6 +94,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lucas-clemente/quic-go v0.20.1/go.mod h1:fZq/HUDIM+mW6X6wtzORjC0E/WDBMKe5Hf9bgjISwLk=
github.com/lucas-clemente/quic-go v0.25.0 h1:K+X9Gvd7JXsOHtU0N2icZ2Nw3rx82uBej3mP4CLgibc=
github.com/lucas-clemente/quic-go v0.25.0/go.mod h1:YtzP8bxRVCBlO77yRanE264+fY/T2U9ZlW1AaHOsMOg=
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
Expand Down Expand Up @@ -251,8 +254,10 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201231184435-2d18734c6014/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down
6 changes: 4 additions & 2 deletions cmd/ugatex/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,20 @@ replace github.com/costinm/ugate/ext/quic => ../../ext/quic
//replace github.com/lucas-clemente/quic-go => ../../../quic

replace github.com/costinm/ugate/ext/gvisor => ../../ext/gvisor

replace github.com/costinm/ugate/ext/lwip => ../../ext/lwip

replace gvisor.dev/gvisor => github.com/costinm/gvisor v0.0.0-20210509154143-a94fe58cda62

//replace gvisor.dev/gvisor => ../../../gvisor

replace github.com/eycorsican/go-tun2socks => github.com/costinm/go-tun2socks v1.16.12-0.20210328172757-88f6d54235cb

//replace github.com/lucas-clemente/quic-go => github.com/costinm/quic v0.5.1-0.20210425224043-9f67435d0255

require (
github.com/costinm/ugate v0.0.0-20210425213441-05024f5e8910
github.com/costinm/ugate/dns v0.0.0-20210425213441-05024f5e8910
github.com/costinm/ugate v0.0.0-20211023174040-9f00d2d3fca1
github.com/costinm/ugate/dns v0.0.0-20211023174040-9f00d2d3fca1
github.com/costinm/ugate/ext/bootstrap v0.0.0-00010101000000-000000000000
github.com/costinm/ugate/ext/bootstrapx v0.0.0-00010101000000-000000000000
)
8 changes: 8 additions & 0 deletions cmd/ugatex/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb0
github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/bazelbuild/rules_go v0.25.1 h1:kFMT+OgT62SY3tBTRYFJBTphOHHoCfyn5wbRFNauKUQ=
github.com/bazelbuild/rules_go v0.25.1/go.mod h1:MC23Dc/wkXEyk3Wpq6lCqz0ZAYOZDw2DR5y3N1q2i7M=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down Expand Up @@ -103,8 +104,10 @@ github.com/costinm/ugate/ext/gvisor v0.0.0-20210509234022-4f213a5560be h1:aL12Pe
github.com/costinm/ugate/ext/gvisor v0.0.0-20210509234022-4f213a5560be/go.mod h1:stbrEb5l0TYdEFDmO2E6OCKNgExBQZTEQxC1gHydKmk=
github.com/costinm/ugate/ext/lwip v0.0.0-20210509234022-4f213a5560be h1:QG+ZE+IDMEpdvOqT0h0HKeS6NCD3cbJQ+j8yncgz9Ro=
github.com/costinm/ugate/ext/lwip v0.0.0-20210509234022-4f213a5560be/go.mod h1:2AWmC9WBWNY2DJKVGKRCrS5jhveOB343BnACODztQBA=
github.com/costinm/ugate/ext/ssh v0.0.0-20210617045128-ebd612515d2b/go.mod h1:S7btMWV5yq2oAZbOh+Oy+dMLl3E6VUgfgoaQGADO4P0=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.13/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -135,6 +138,7 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/gliderlabs/ssh v0.3.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
Expand Down Expand Up @@ -254,11 +258,13 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.4-0.20190131011033-7dc38fb350b1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lucas-clemente/quic-go v0.20.1/go.mod h1:fZq/HUDIM+mW6X6wtzORjC0E/WDBMKe5Hf9bgjISwLk=
github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI=
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
Expand Down Expand Up @@ -365,6 +371,7 @@ github.com/pion/webrtc/v3 v3.0.25/go.mod h1:Qx9zd4xvIeFTN1hygyJ77XVi/YbElyjVitL6
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
Expand Down Expand Up @@ -466,6 +473,7 @@ golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b h1:7mWr3k41Qtv8XlltBkDkl8LoP3mpSgBW8BUoxtEdbXg=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down
22 changes: 22 additions & 0 deletions docs/others.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,25 @@ gost -L=:8080


```

# OpenZiti


- SDK-based (proxyless) with optional tunneler
- tunneler uses lwip, tun - and the SDK

- WASM openssl repo - for browser zero trust, mTLS over WS
- 'id file' - a json config file. uGate started to use kubeconfig format.

Services are similar with Clusters and K8S Service.

API:
- Options: onContextReady, onServiceUpdate
- Dial, DialWithOptions -> edge.Conn (net.Conn, CloseWriter, GetAppData,
SourceIdentifier, TraceRoute(!), Id() uint32, )
- channel.Underlay: Rx, Tx on Message, Identity, Headers


Issues:
- Dial doesn't seem to take context. DialWithOptions has timeout, initial data.
-
39 changes: 30 additions & 9 deletions docs/protocols.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,53 @@
# Low level protocols used

UGate primary/target protocol is H3 - it is most flexible and most likely the future.

## H3 frames
One of the goals of a gateway is to support multiple protocols, for interop and
connectivity.

A brief summary of the low levels of each protocol and overhead.

## H2/H3 frames

H2 frame format - 9 byte header:
- Len(24)
- Len(24) - 16M chunks
- Type(8)
- Flags(8)
- StreamID(32)

H2 int format, used in HPACK and QPACK: mix of varint and 'N-bit prefix'.
Short ints are 1 B (with few bits for flags), rest are varint, first byte uses 1111... for the N bits.

Short ints are 1 B (with few bits for flags), rest are varint, first byte
uses 1111... for the N bits.

QUIC int use first 2 bits to encode length ( 1,2,4,8)


HTTP uses compressed headers, but can be turned off in custom protocols.

Core benefits:
- broadly adopted and many implementations
- multiplexed - less TCP/TLS overhead
- flow control for each stream


## Websocket frames

After handshake, WS sends frames including at least 2B overhead for server originated,
and 2B + 4B(mask) for client:

- FIN
- frame type - ping, ping, text, binary, cont, close
- payload - 1B or 3 B
-
- TYPE(1B): FIN, frame type - ping, pony, text, binary, cont, close
- payload len - 1B or 3 B

Client frames must have a 4B 'mask'

WS is not multiplexed - for HTTP/1.1 upgrade it is ideal for multiplexing H2.

If protocol is H2 already - it's just a stream.

# WebRTC

In future it may use QUIC - currently UDP+SCTP. Best protocol for interop with web browsers, 2-way.
In future it may use QUIC - currently UDP+SCTP. Best protocol for interop with web
browsers, 2-way.

- like quic, low level frames and implementations duplicate TCP, include flow control
-
12 changes: 8 additions & 4 deletions ext/bootstrap/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/costinm/ugate/ext/bootstrap

go 1.16
go 1.18

replace github.com/costinm/ugate => ../../

Expand All @@ -9,17 +9,21 @@ replace github.com/costinm/ugate/dns => ../../dns
replace github.com/costinm/ugate/ext/h2r => ../h2r

replace github.com/costinm/ugate/ext/quic => ../quic

replace github.com/costinm/ugate/ext/xds => ../xds

replace github.com/costinm/ssh-mesh => ../../../ssh-mesh

//Larger buffer, hooks to use the h3 stack
//replace github.com/lucas-clemente/quic-go => ../../../quic
//replace github.com/lucas-clemente/quic-go => github.com/costinm/quic v0.5.1-0.20210425224043-9f67435d0255

require (
github.com/costinm/ssh-mesh v0.0.0-20220429182219-8b008c6822f6
github.com/costinm/ugate v0.0.0-20210425213441-05024f5e8910
github.com/costinm/ugate/dns v0.0.0-20211023174040-9f00d2d3fca1
github.com/costinm/ugate/ext/h2r v0.0.0-20210425213441-05024f5e8910
github.com/costinm/ugate/ext/quic v0.0.0-20210425213441-05024f5e8910
github.com/costinm/ugate/ext/ssh v0.0.0-20210617045128-ebd612515d2b
github.com/costinm/ugate/ext/xds v0.0.0-20210617045128-ebd612515d2b
google.golang.org/grpc v1.37.0
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e
golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6 // indirect
)
Loading

0 comments on commit cafcfb6

Please sign in to comment.