Commit 17fc901
committed
Refactor the gate.AutoRegister API and hide the portal pb.go files
This should probably be several commits but it's too much and I don't
feel like splitting it up.
1. Hid the protos from the public go API. This will enable me to drop
gRPC or maybe even protos entirely without changing the go API
again. Another reason for this is there are now two different
output styles protoc can do for go code and this will allow me to
update as proto styles update without breaking my API. This also
lets me have nice things like tls.Config in the structs and uint16
for port numbers (which protos don't support). So there's also
wrapper functions for all the RPCs now.
2. gate.AutoRegister no longer returns an annoying results struct.
Also client.AutoRegisterChan is now just client.AutoRegister and it
takes a callback function instead of a channel to write to (it's a
more flexible API, you don't have to have goroutines just to split
channels etc).
3. tools.HTTPServer now takes a context not a quit channel
4. Dropped tools.AutoTLSConf for now because I'm still debating what
the right API for it should be. I want to have something like that
still but I'm going to keep it private until I like the API better.
5. Using crypto.PrivateKey instead of crypto.Signer now because it's
more semantically correct
Most of this I actually wrote months ago. I decided back then I want to
try harder to have no dependencies and chose to move towards dropping
gRPC and this was my solution. Back then I inevitably lost momentum and
left myself with a difficult list of problems about how to import the
private protos across binaries and what to do about using prototext as
the public config file API for assimilate and spawn as well as the
gRPC/proto public API of the portal server. I also keep going back and
forth on the best API for AutoRegister (I don't love the one that spawns
a background goroutine still).
I suppose I'm moving towards using context instead of quit chans in all
the public APIs. I do think it's more friendly and idiomatic. I used to
kind of want to rebel against having ctx be the first arg of everything.
Recently I only fixed up the compile errors and got it ready to actually
commit.1 parent f1b73b8 commit 17fc901
File tree
28 files changed
+1134
-1160
lines changed- assimilate/embedassimilate
- host/embedhost
- internal/portalpb
- portal
- embedportal
- gate
- spawn/embedspawn
- tools
28 files changed
+1134
-1160
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
73 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 107 | + | |
| 108 | + | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments