Skip to content

Commit d22cb4a

Browse files
committed
TUN-6015: Add RPC method for pushing local config
1 parent 8f0498f commit d22cb4a

File tree

4 files changed

+454
-220
lines changed

4 files changed

+454
-220
lines changed

tunnelrpc/pogs/connectionrpc.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
type RegistrationServer interface {
1919
RegisterConnection(ctx context.Context, auth TunnelAuth, tunnelID uuid.UUID, connIndex byte, options *ConnectionOptions) (*ConnectionDetails, error)
2020
UnregisterConnection(ctx context.Context)
21+
UpdateLocalConfiguration(ctx context.Context, config []byte) error
2122
}
2223

2324
type RegistrationServer_PogsImpl struct {
@@ -88,6 +89,17 @@ func (i RegistrationServer_PogsImpl) UnregisterConnection(p tunnelrpc.Registrati
8889
return nil
8990
}
9091

92+
func (i RegistrationServer_PogsImpl) UpdateLocalConfiguration(c tunnelrpc.RegistrationServer_updateLocalConfiguration) error {
93+
server.Ack(c.Options)
94+
95+
configBytes, err := c.Params.Config()
96+
if err != nil {
97+
return err
98+
}
99+
100+
return i.impl.UpdateLocalConfiguration(c.Ctx, configBytes)
101+
}
102+
91103
type RegistrationServer_PogsClient struct {
92104
Client capnp.Client
93105
Conn *rpc.Conn

tunnelrpc/pogs/connectionrpc_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ type testConnectionRegistrationServer struct {
129129
err error
130130
}
131131

132+
func (t *testConnectionRegistrationServer) UpdateLocalConfiguration(ctx context.Context, config []byte) error {
133+
// do nothing at this point
134+
return nil
135+
}
136+
132137
func (t *testConnectionRegistrationServer) RegisterConnection(ctx context.Context, auth TunnelAuth, tunnelID uuid.UUID, connIndex byte, options *ConnectionOptions) (*ConnectionDetails, error) {
133138
if auth.AccountTag != testAccountTag {
134139
panic("bad account tag: " + auth.AccountTag)

tunnelrpc/tunnelrpc.capnp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ struct TunnelAuth {
131131
interface RegistrationServer {
132132
registerConnection @0 (auth :TunnelAuth, tunnelId :Data, connIndex :UInt8, options :ConnectionOptions) -> (result :ConnectionResponse);
133133
unregisterConnection @1 () -> ();
134+
updateLocalConfiguration @2 (config :Data) -> ();
134135
}
135136

136137
interface TunnelServer extends (RegistrationServer) {

0 commit comments

Comments
 (0)