TUN-5488: Close session after it's idle for a period defined by registerUdpSession RPC

This commit is contained in:
cthuang
2021-12-02 11:02:27 +00:00
parent 9bc59bc78c
commit 73a265f2fc
13 changed files with 456 additions and 253 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"io"
"net"
"time"
capnp "zombiezen.com/go/capnproto2"
"zombiezen.com/go/capnproto2/rpc"
@@ -239,8 +240,8 @@ func NewRPCClientStream(ctx context.Context, stream io.ReadWriteCloser, logger *
}, nil
}
func (rcs *RPCClientStream) RegisterUdpSession(ctx context.Context, sessionID uuid.UUID, dstIP net.IP, dstPort uint16) error {
resp, err := rcs.client.RegisterUdpSession(ctx, sessionID, dstIP, dstPort)
func (rcs *RPCClientStream) RegisterUdpSession(ctx context.Context, sessionID uuid.UUID, dstIP net.IP, dstPort uint16, closeIdleAfterHint time.Duration) error {
resp, err := rcs.client.RegisterUdpSession(ctx, sessionID, dstIP, dstPort, closeIdleAfterHint)
if err != nil {
return err
}