feat: port forwarding

This commit is contained in:
tobyxdd
2023-07-02 15:40:16 -07:00
parent 8ca414e548
commit 7e177a22f7
14 changed files with 592 additions and 153 deletions

View File

@@ -15,25 +15,25 @@ const (
testKeyFile = "test.key"
)
type mockEchoHyClient struct{}
type mockHyClient struct{}
func (c *mockEchoHyClient) DialTCP(addr string) (net.Conn, error) {
func (c *mockHyClient) DialTCP(addr string) (net.Conn, error) {
return net.Dial("tcp", addr)
}
func (c *mockEchoHyClient) ListenUDP() (client.HyUDPConn, error) {
func (c *mockHyClient) ListenUDP() (client.HyUDPConn, error) {
// Not implemented
return nil, errors.New("not implemented")
}
func (c *mockEchoHyClient) Close() error {
func (c *mockHyClient) Close() error {
return nil
}
func TestServer(t *testing.T) {
// Start the server
s := &Server{
HyClient: &mockEchoHyClient{},
HyClient: &mockHyClient{},
}
l, err := net.Listen("tcp", "127.0.0.1:18080")
if err != nil {