Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTLS transport #166

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ FROM base_pfring as conjure
COPY sysconfig/conjure.conf /opt/conjure/sysconfig/
COPY scripts/ /opt/conjure/scripts/

RUN apt update && apt install -yq libzmq3-dev iproute2
RUN apt update && apt install -yq libzmq3-dev iproute2 ethtool
COPY --from=dev_img /opt/conjure/bin/ /opt/conjure/bin/

# ENTRYPOINT /bin/bash
4 changes: 2 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ CJ_IP4_ADDR=127.0.0.1
CJ_IP6_ADDR=[::1]

# application
CJ_STATION_CONFIG=/var/lib/conjure/application_config.toml
CJ_STATION_CONFIG=/var/lib/conjure/app_config.toml
PHANTOM_SUBNET_LOCATION=/var/lib/conjure/phantom_subnets.toml

# registration server
Expand Down Expand Up @@ -269,4 +269,4 @@ For detailed and up-to-date installation instructions refer to official ntop doc

- Encountered err when creating Reg: Failed to select phantom IP address: generation number not recognized
- Make sure conjure/docker/phantom_subnets.toml contains the client's generations
- Can be caused by clients using API trying to connect, since API is enabled by default. Can be disabled by removing `[[connect_sockets]]` entry for the API from `conjure/application/config.toml`
- Can be caused by clients using API trying to connect, since API is enabled by default. Can be disabled by removing `[[connect_sockets]]` entry for the API from `cmd/application/app_config.toml`
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/BurntSushi/toml v1.3.2
github.com/flynn/noise v1.0.0
github.com/go-redis/redis/v8 v8.11.5
github.com/golang/protobuf v1.5.3
github.com/google/gopacket v1.1.19
github.com/gorilla/mux v1.8.0
github.com/hashicorp/golang-lru v1.0.2
Expand All @@ -20,7 +21,6 @@ require (
github.com/pion/stun v0.6.1
github.com/pion/transport/v2 v2.2.3
github.com/refraction-networking/ed25519 v0.1.2
github.com/refraction-networking/gotapdance v1.7.1
github.com/refraction-networking/obfs4 v0.1.2
github.com/refraction-networking/utls v1.3.3
github.com/sirupsen/logrus v1.9.3
Expand All @@ -40,11 +40,11 @@ require (
github.com/dchest/siphash v1.2.3 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/gaukas/godicttls v0.0.4 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/onsi/gomega v1.27.6 // indirect
github.com/oschwald/maxminddb-golang v1.12.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/oschwald/maxminddb-golang v1.11.0 // indirect
github.com/pion/randutil v0.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/refraction-networking/gotapdance v1.7.3 // indirect
github.com/sergeyfrolov/bsbuffer v0.0.0-20180903213811-94e85abb8507 // indirect
golang.org/x/text v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -55,3 +55,5 @@ replace github.com/pion/dtls/v2 => github.com/mingyech/dtls/v2 v2.0.0
replace github.com/pion/transport/v2 => github.com/mingyech/transport/v2 v2.0.0

replace github.com/refraction-networking/gotapdance => github.com/refraction-networking/gotapdance v1.7.3-0.20230914182507-7d8ccbce6eb2

replace github.com/refraction-networking/utls => ../utls
17 changes: 11 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ github.com/gaukas/godicttls v0.0.4/go.mod h1:l6EenT4TLWgTdwslVb4sEMOCf7Bv0JAK67d
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8=
Expand All @@ -27,8 +29,8 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand All @@ -46,12 +48,11 @@ github.com/mroth/weightedrand v1.0.0 h1:V8JeHChvl2MP1sAoXq4brElOcza+jxLkRuwvtQu8
github.com/mroth/weightedrand v1.0.0/go.mod h1:3p2SIcC8al1YMzGhAIoXD+r9olo/g/cdJgAD905gyNE=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/oschwald/geoip2-golang v1.9.0 h1:uvD3O6fXAXs+usU+UGExshpdP13GAqp4GBrzN7IgKZc=
github.com/oschwald/geoip2-golang v1.9.0/go.mod h1:BHK6TvDyATVQhKNbQBdrj9eAvuwOMi2zSFXizL3K81Y=
github.com/oschwald/maxminddb-golang v1.12.0 h1:9FnTOD0YOhP7DGxGsq4glzpGy5+w7pq50AS6wALUMYs=
github.com/oschwald/maxminddb-golang v1.12.0/go.mod h1:q0Nob5lTCqyQ8WT6FYgS1L7PXKVVbgiymefNwIjPzgY=
github.com/oschwald/maxminddb-golang v1.11.0 h1:aSXMqYR/EPNjGE8epgqwDay+P30hCBZIveY0WZbAWh0=
github.com/oschwald/maxminddb-golang v1.11.0/go.mod h1:YmVI+H0zh3ySFR3w+oz8PCfglAFj3PuCmui13+P9zDg=
github.com/pebbe/zmq4 v1.2.10 h1:wQkqRZ3CZeABIeidr3e8uQZMMH5YAykA/WN0L5zkd1c=
github.com/pebbe/zmq4 v1.2.10/go.mod h1:nqnPueOapVhE2wItZ0uOErngczsJdLOGkebMxaO8r48=
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
Expand All @@ -73,6 +74,8 @@ github.com/refraction-networking/gotapdance v1.7.3-0.20230914182507-7d8ccbce6eb2
github.com/refraction-networking/gotapdance v1.7.3-0.20230914182507-7d8ccbce6eb2/go.mod h1:svhsxN8LGv3FSL1RKLFXG74tWEXQ8m1xb9rFEZF2abk=
github.com/refraction-networking/obfs4 v0.1.2 h1:J842O4fGSkd2W8ogYj0KN6gqVVY+Cpqodw9qFGL7wVU=
github.com/refraction-networking/obfs4 v0.1.2/go.mod h1:wAl/+gWiLsrcykJA3nKJHx89f5/gXGM8UKvty7+mvbM=
github.com/refraction-networking/utls v1.3.3-0.20230716160308-d1757c6b7716 h1:FXRAIzKKDmI/eYkfBW+1Lvg97Vc7rx7ia0xKBEY98BI=
github.com/refraction-networking/utls v1.3.3-0.20230716160308-d1757c6b7716/go.mod h1:fmoaOww2bxzzEpIKOebIsnBvjQpqP7L2vcm/9KUfm/E=
github.com/refraction-networking/utls v1.3.3 h1:f/TBLX7KBciRyFH3bwupp+CE4fzoYKCirhdRcC490sw=
github.com/refraction-networking/utls v1.3.3/go.mod h1:DlecWW1LMlMJu+9qpzzQqdHDT/C2LAe03EdpLUz/RL8=
github.com/sergeyfrolov/bsbuffer v0.0.0-20180903213811-94e85abb8507 h1:ML7ZNtcln5UBo5Wv7RIv9Xg3Pr5VuRCWLFXEwda54Y4=
Expand Down Expand Up @@ -150,13 +153,15 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T
google.golang.org/grpc v1.58.0 h1:32JY8YpPMSR45K+c3o6b8VL73V+rR8k+DeMIr4vRH8o=
google.golang.org/grpc v1.58.0/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ github.com/felixge/fgprof v0.9.3/go.mod h1:RdbpDgzqYVh/T9fPELJyV7EYJuHB55UTEULNu
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd h1:1FjCyPC+syAzJ5/2S8fqdZK1R22vvA0J7JZKcuOIQ7Y=
Expand Down
3 changes: 2 additions & 1 deletion internal/testutils/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/refraction-networking/conjure/internal/conjurepath"
"github.com/refraction-networking/conjure/pkg/core"
dd "github.com/refraction-networking/conjure/pkg/station/lib"
"github.com/refraction-networking/conjure/pkg/transports"
pb "github.com/refraction-networking/conjure/proto"
"google.golang.org/grpc/test/bufconn"
"google.golang.org/protobuf/reflect/protoreflect"
Expand All @@ -25,7 +26,7 @@ var TestSubnetPath = conjurepath.Root + "/internal/test_assets/phantom_subnets.t

// SetupPhantomConnections registers one session with the provided transport and
// registration manager using a pre-determined kay and phantom subnet file.
func SetupPhantomConnections(manager *dd.RegistrationManager, transport pb.TransportType, params protoreflect.ProtoMessage, libver uint) (clientToPhantom net.Conn, serverFromPhantom net.Conn, reg *dd.DecoyRegistration) {
func SetupPhantomConnections(manager *dd.RegistrationManager, transport pb.TransportType, params protoreflect.ProtoMessage, libver uint) (clientToPhantom net.Conn, serverFromPhantom net.Conn, reg transports.Registration) {
return SetupPhantomConnectionsSecret(manager, transport, params, SharedSecret, libver, TestSubnetPath)
}

Expand Down
29 changes: 28 additions & 1 deletion internal/transport_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"github.com/refraction-networking/conjure/pkg/transports/wrapping/min"
"github.com/refraction-networking/conjure/pkg/transports/wrapping/obfs4"
"github.com/refraction-networking/conjure/pkg/transports/wrapping/prefix"
"github.com/refraction-networking/conjure/pkg/transports/wrapping/utls"
pb "github.com/refraction-networking/conjure/proto"
"github.com/refraction-networking/ed25519"
"github.com/refraction-networking/ed25519/extra25519"
Expand Down Expand Up @@ -76,6 +77,15 @@
&min.ClientTransport{},
genericParamPermutations,
},
{
func(privKey [32]byte) lib.WrappingTransport {
tr, err := utls.New(privKey)
require.Nil(t, err)
return tr
},
&utls.ClientTransport{},
utlsClientParamPermutations,
},
}
for _, testCase := range testCases {
t.Run(testCase.clientTransport.Name(), func(t *testing.T) {
Expand Down Expand Up @@ -220,10 +230,10 @@
}

func (p *genericParams) String() string {
return fmt.Sprintf("randDstPort: %t", p.GetRandomizeDstPort())

Check failure on line 233 in internal/transport_integration_test.go

View workflow job for this annotation

GitHub Actions / Format and Lint with golangci-lint

p.GetRandomizeDstPort undefined (type *genericParams has no field or method GetRandomizeDstPort) (typecheck)
}

// ClientParamPermutations returns a list of client parameters for inclusions in tests that require
// prefixClientParamPermutations returns a list of client parameters for inclusions in tests that require
// variance.
func prefixClientParamPermutations() []TestParams {
paramSet := []TestParams{}
Expand All @@ -242,3 +252,20 @@
}
return paramSet
}

// utlsClientParamPermutations returns a list of client parameters for inclusions in tests that require
// variance.
func utlsClientParamPermutations() []TestParams {
paramSet := []TestParams{}
for _, chID := range []int32{0, 1, 2, 3, 4, 5} {
for _, rand := range []bool{true, false} {
var p int32 = int32(chID)
params := &utls.ClientParams{
ClientHelloID: p,
RandomizeDstPort: rand,
}
paramSet = append(paramSet, params)
}
}
return paramSet
}
19 changes: 14 additions & 5 deletions pkg/transports/wrapping/min/min_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ func TestSuccessfulWrap(t *testing.T) {
defer sfp.Close()
require.NotNil(t, reg)

hmacID := core.ConjureHMAC(reg.Keys.SharedSecret, "MinTrasportHMACString")
phantom := reg.PhantomIP()
require.NotNil(t, phantom)

hmacID := core.ConjureHMAC(reg.SharedSecret(), "MinTrasportHMACString")
message := []byte(`test message!`)

_, err := c2p.Write(append(hmacID, message...))
Expand All @@ -40,7 +43,7 @@ func TestSuccessfulWrap(t *testing.T) {
n, _ := sfp.Read(buf[:])
buffer.Write(buf[:n])

_, wrapped, err := transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, wrapped, err := transport.WrapConnection(&buffer, sfp, *phantom, manager)
require.Nil(t, err, "error getting wrapped connection")

received := make([]byte, len(message))
Expand All @@ -56,6 +59,9 @@ func TestUnsuccessfulWrap(t *testing.T) {
defer c2p.Close()
defer sfp.Close()

phantom := reg.PhantomIP()
require.NotNil(t, phantom)

// No real reason for sending the shared secret; it's just 32 bytes
// (same length as HMAC ID) that should have no significance.
_, err := c2p.Write(tests.SharedSecret)
Expand All @@ -66,7 +72,7 @@ func TestUnsuccessfulWrap(t *testing.T) {
n, _ := sfp.Read(buf[:])
buffer.Write(buf[:n])

_, _, err = transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, _, err = transport.WrapConnection(&buffer, sfp, *phantom, manager)
if !errors.Is(err, transports.ErrNotTransport) {
t.Fatalf("expected ErrNotTransport, got %v", err)
}
Expand All @@ -80,6 +86,9 @@ func TestTryAgain(t *testing.T) {
defer c2p.Close()
defer sfp.Close()

phantom := reg.PhantomIP()
require.NotNil(t, phantom)

var buf [32]byte
var buffer bytes.Buffer
for _, b := range tests.SharedSecret[:31] {
Expand All @@ -89,7 +98,7 @@ func TestTryAgain(t *testing.T) {
n, _ := sfp.Read(buf[:])
buffer.Write(buf[:n])

_, _, err = transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, _, err = transport.WrapConnection(&buffer, sfp, *phantom, manager)
if !errors.Is(err, transports.ErrTryAgain) {
t.Fatalf("expected ErrTryAgain, got %v", err)
}
Expand All @@ -100,7 +109,7 @@ func TestTryAgain(t *testing.T) {

n, _ := sfp.Read(buf[:])
buffer.Write(buf[:n])
_, _, err = transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, _, err = transport.WrapConnection(&buffer, sfp, *phantom, manager)
if !errors.Is(err, transports.ErrNotTransport) {
t.Fatalf("expected ErrNotTransport, got %v", err)
}
Expand Down
19 changes: 14 additions & 5 deletions pkg/transports/wrapping/obfs4/obfs4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ func TestSuccessfulWrap(t *testing.T) {
defer c2p.Close()
defer sfp.Close()

phantom := reg.PhantomIP()
require.NotNil(t, phantom)

wrappedc2p := make(chan net.Conn)
stateDir := ""
keys := reg.Keys.TransportKeys.(Obfs4Keys)
keys := reg.TransportKeys().(Obfs4Keys)
go wrapConnection(c2p, keys.NodeID.Hex(), keys.PublicKey.Hex(), wrappedc2p, stateDir)

var buf [4096]byte
Expand All @@ -76,7 +79,7 @@ func TestSuccessfulWrap(t *testing.T) {
n, _ := sfp.Read(buf[:])
buffer.Write(buf[:n])

_, wrappedsfp, err = transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, wrappedsfp, err = transport.WrapConnection(&buffer, sfp, *phantom, manager)
if errors.Is(err, transports.ErrTryAgain) {
continue
} else if err != nil {
Expand Down Expand Up @@ -191,6 +194,9 @@ func TestUnsuccessfulWrap(t *testing.T) {
defer c2p.Close()
defer sfp.Close()

phantom := reg.PhantomIP()
require.NotNil(t, phantom)

_, err = io.Copy(c2p, io.LimitReader(rand.New(rand.NewSource(0)), 8192))
require.Nil(t, err)

Expand All @@ -199,7 +205,7 @@ func TestUnsuccessfulWrap(t *testing.T) {
n, _ := io.ReadFull(sfp, buf[:])
buffer.Write(buf[:n])

_, _, err = transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, _, err = transport.WrapConnection(&buffer, sfp, *phantom, manager)
if !errors.Is(err, transports.ErrNotTransport) {
t.Fatalf("expected ErrNotTransport, got %v", err)
}
Expand All @@ -213,6 +219,9 @@ func TestTryAgain(t *testing.T) {
defer c2p.Close()
defer sfp.Close()

phantom := reg.PhantomIP()
require.NotNil(t, phantom)

r := rand.New(rand.NewSource(0))
var buf [8192]byte
var buffer bytes.Buffer
Expand All @@ -225,7 +234,7 @@ func TestTryAgain(t *testing.T) {
n, _ := sfp.Read(buf[:])
buffer.Write(buf[:n])

_, _, err = transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, _, err = transport.WrapConnection(&buffer, sfp, *phantom, manager)
if !errors.Is(err, transports.ErrTryAgain) {
t.Fatalf("expected ErrTryAgain, got %v", err)
}
Expand All @@ -236,7 +245,7 @@ func TestTryAgain(t *testing.T) {

n, _ := sfp.Read(buf[:])
buffer.Write(buf[:n])
_, _, err = transport.WrapConnection(&buffer, sfp, reg.PhantomIp, manager)
_, _, err = transport.WrapConnection(&buffer, sfp, *phantom, manager)
if !errors.Is(err, transports.ErrNotTransport) {
t.Fatalf("expected ErrNotTransport, got %v", err)
}
Expand Down
Loading
Loading