Provide a worker decryption function to proxy handlers (#2784)

This commit is contained in:
Todd authored and GitHub committed 2023-01-12 13:16:36 -08:00
1 parent 0b87acb896
commit 38b74ce897
6 files changed
+62 -22

No files matched your search

+2 -4
View File
@@ -14,7 +14,7 @@ import (
func TestRegisterHandler(t *testing.T) {
assert, require := assert.New(t), require.New(t)
fn := func(context.Context, net.Conn, *ProxyDialer, string, *anypb.Any) (ProxyConnFn, error) {
fn := func(context.Context, DecryptFn, net.Conn, *ProxyDialer, string, *anypb.Any) (ProxyConnFn, error) {
return nil, nil
}
oldHandler := handlers
@@ -37,7 +37,7 @@ func TestRegisterHandler(t *testing.T) {
func TestAlwaysTcpGetHandler(t *testing.T) {
assert, require := assert.New(t), require.New(t)
fn := func(context.Context, net.Conn, *ProxyDialer, string, *anypb.Any) (ProxyConnFn, error) {
fn := func(context.Context, DecryptFn, net.Conn, *ProxyDialer, string, *anypb.Any) (ProxyConnFn, error) {
return nil, nil
}
oldHandler := handlers
@@ -45,9 +45,7 @@ func TestAlwaysTcpGetHandler(t *testing.T) {
handlers = oldHandler
})
handlers = sync.Map{}
_, err := tcpOnly("wid", nil)
require.Error(err)
assert.ErrorIs(err, ErrUnknownProtocol)
require.NoError(RegisterHandler("tcp", fn))