Skip to content

Commit 3ed7fe2

Browse files
committed
rebase onto new master layout
1 parent 64114eb commit 3ed7fe2

File tree

7 files changed

+31
-135
lines changed

7 files changed

+31
-135
lines changed

docker/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ CJ_IP4_ADDR=127.0.0.1
154154
CJ_IP6_ADDR=[::1]
155155

156156
# application
157-
CJ_STATION_CONFIG=/var/lib/conjure/application_config.toml
157+
CJ_STATION_CONFIG=/var/lib/conjure/app_config.toml
158158
PHANTOM_SUBNET_LOCATION=/var/lib/conjure/phantom_subnets.toml
159159

160160
# registration server
@@ -269,4 +269,4 @@ For detailed and up-to-date installation instructions refer to official ntop doc
269269
270270
- Encountered err when creating Reg: Failed to select phantom IP address: generation number not recognized
271271
- Make sure conjure/docker/phantom_subnets.toml contains the client's generations
272-
- 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`
272+
- 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`

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/pelletier/go-toml v1.9.5
2020
github.com/pion/stun v0.3.5
2121
github.com/refraction-networking/gotapdance v1.5.5
22-
github.com/refraction-networking/utls v1.2.0
22+
github.com/refraction-networking/utls v1.3.2
2323
github.com/sirupsen/logrus v1.9.0
2424
github.com/stretchr/testify v1.8.1
2525
gitlab.com/yawning/obfs4.git v0.0.0-20230519154740-645026c2ada4
@@ -31,13 +31,15 @@ require (
3131

3232
require (
3333
filippo.io/edwards25519 v1.0.0 // indirect
34-
github.com/andybalholm/brotli v1.0.4 // indirect
34+
github.com/andybalholm/brotli v1.0.5 // indirect
3535
github.com/cespare/xxhash/v2 v2.2.0 // indirect
3636
github.com/davecgh/go-spew v1.1.1 // indirect
3737
github.com/dchest/siphash v1.2.3 // indirect
3838
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
39+
github.com/flynn/noise v1.0.0 // indirect
40+
github.com/gaukas/godicttls v0.0.3 // indirect
3941
github.com/golang/protobuf v1.5.3 // indirect
40-
github.com/klauspost/compress v1.15.12 // indirect
42+
github.com/klauspost/compress v1.16.5 // indirect
4143
github.com/oschwald/maxminddb-golang v1.10.0 // indirect
4244
github.com/pmezard/go-difflib v1.0.0 // indirect
4345
github.com/sergeyfrolov/bsbuffer v0.0.0-20180903213811-94e85abb8507 // indirect

go.sum

Lines changed: 0 additions & 112 deletions
This file was deleted.

pkg/transports/wrapping/min/client.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ type ClientTransport struct {
2222
connectTag []byte
2323
}
2424

25+
const (
26+
HMACString = "MinTrasportHMACString"
27+
)
28+
2529
// Name returns a string identifier for the Transport for logging
2630
func (*ClientTransport) Name() string {
2731
return "min"
@@ -92,6 +96,6 @@ func (t *ClientTransport) WrapConn(conn net.Conn) (net.Conn, error) {
9296
// as well as bytes from the deterministic random generator associated with the registration
9397
// that this ClientTransport is attached t
9498
func (t *ClientTransport) PrepareKeys(pubkey [32]byte, sharedSecret []byte, dRand io.Reader) error {
95-
t.connectTag = core.ConjureHMAC(sharedSecret, hmacString)
99+
t.connectTag = core.ConjureHMAC(sharedSecret, HMACString)
96100
return nil
97101
}

application/transports/wrapping/utls/client.go renamed to pkg/transports/wrapping/utls/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package utls
33
import (
44
"fmt"
55

6-
"github.com/refraction-networking/conjure/application/transports"
7-
pb "github.com/refraction-networking/gotapdance/protobuf"
6+
"github.com/refraction-networking/conjure/pkg/transports"
7+
pb "github.com/refraction-networking/conjure/proto"
88
"google.golang.org/protobuf/proto"
99
)
1010

application/transports/wrapping/utls/utls.go renamed to pkg/transports/wrapping/utls/utls.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import (
1010
"net"
1111
"regexp"
1212

13-
dd "github.com/refraction-networking/conjure/application/lib"
14-
"github.com/refraction-networking/conjure/application/transports"
15-
pb "github.com/refraction-networking/gotapdance/protobuf"
13+
"github.com/refraction-networking/conjure/pkg/core"
14+
dd "github.com/refraction-networking/conjure/pkg/station/lib"
15+
"github.com/refraction-networking/conjure/pkg/transports"
16+
pb "github.com/refraction-networking/conjure/proto"
1617
tls "github.com/refraction-networking/utls"
1718
"google.golang.org/protobuf/proto"
1819
"google.golang.org/protobuf/types/known/anypb"
@@ -58,7 +59,7 @@ func (Transport) LogPrefix() string { return "UTLS" }
5859
// identifier should be unique for each registration on a given phantom;
5960
// registrations on different phantoms can have the same identifier.
6061
func (Transport) GetIdentifier(d *dd.DecoyRegistration) string {
61-
return string(d.Keys.ConjureHMAC(hmacString))
62+
return string(core.ConjureHMAC(d.Keys.SharedSecret, hmacString))
6263
}
6364

6465
// GetProto returns the next layer protocol that the transport uses. Implements

application/transports/wrapping/utls/utls_test.go renamed to pkg/transports/wrapping/utls/utls_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import (
2121
"github.com/stretchr/testify/require"
2222
"google.golang.org/protobuf/types/known/anypb"
2323

24-
cj "github.com/refraction-networking/conjure/application/lib"
25-
"github.com/refraction-networking/conjure/application/transports"
26-
"github.com/refraction-networking/conjure/application/transports/wrapping/internal/tests"
27-
pb "github.com/refraction-networking/gotapdance/protobuf"
24+
"github.com/refraction-networking/conjure/pkg/core"
25+
cj "github.com/refraction-networking/conjure/pkg/station/lib"
26+
"github.com/refraction-networking/conjure/pkg/transports"
27+
"github.com/refraction-networking/conjure/pkg/transports/wrapping/internal/tests"
28+
pb "github.com/refraction-networking/conjure/proto"
2829
tls "github.com/refraction-networking/utls"
2930
)
3031

@@ -34,7 +35,7 @@ func connect(conn net.Conn, reg *cj.DecoyRegistration) (net.Conn, error) {
3435
config := tls.Config{ServerName: "", InsecureSkipVerify: true}
3536

3637
uTLSConn := tls.UClient(conn, &config, helloID)
37-
hmacID := reg.Keys.ConjureHMAC(hmacString)
38+
hmacID := core.ConjureHMAC(reg.Keys.SharedSecret, hmacString)
3839

3940
newRand := make([]byte, 32)
4041
_, err := rand.Read(newRand)
@@ -97,7 +98,7 @@ func TestByteRegex(t *testing.T) {
9798
}
9899

99100
func TestSuccessfulWrap(t *testing.T) {
100-
testSubnetPath := os.Getenv("GOPATH") + "/src/github.com/refraction-networking/conjure/application/lib/test/phantom_subnets.toml"
101+
testSubnetPath := os.Getenv("GOPATH") + "/src/github.com/refraction-networking/conjure/pkg/lib/test/phantom_subnets.toml"
101102
os.Setenv("PHANTOM_SUBNET_LOCATION", testSubnetPath)
102103

103104
var transport Transport
@@ -156,7 +157,7 @@ func TestSuccessfulWrap(t *testing.T) {
156157
func TestUnsuccessfulWrap(t *testing.T) {
157158
var transport Transport
158159
manager := tests.SetupRegistrationManager(tests.Transport{Index: pb.TransportType_Prefix, Transport: transport})
159-
c2p, sfp, reg := tests.SetupPhantomConnections(manager, pb.TransportType_Prefix)
160+
c2p, sfp, reg := tests.SetupPhantomConnections(manager, pb.TransportType_Prefix, nil, randomizeDstPortMinVersion)
160161
defer c2p.Close()
161162
defer sfp.Close()
162163

@@ -183,7 +184,7 @@ func TestTryAgain(t *testing.T) {
183184
var transport Transport
184185
var err error
185186
manager := tests.SetupRegistrationManager(tests.Transport{Index: pb.TransportType_Prefix, Transport: transport})
186-
c2p, sfp, reg := tests.SetupPhantomConnections(manager, pb.TransportType_Prefix)
187+
c2p, sfp, reg := tests.SetupPhantomConnections(manager, pb.TransportType_Prefix, nil, randomizeDstPortMinVersion)
187188
defer c2p.Close()
188189
defer sfp.Close()
189190

@@ -212,12 +213,12 @@ func TestTryAgain(t *testing.T) {
212213
}
213214

214215
func TestSuccessfulWrapLargeMessage(t *testing.T) {
215-
testSubnetPath := os.Getenv("GOPATH") + "/src/github.com/refraction-networking/conjure/application/lib/test/phantom_subnets.toml"
216+
testSubnetPath := os.Getenv("GOPATH") + "/src/github.com/refraction-networking/conjure/pkg/lib/test/phantom_subnets.toml"
216217
os.Setenv("PHANTOM_SUBNET_LOCATION", testSubnetPath)
217218

218219
var transport Transport
219220
manager := tests.SetupRegistrationManager(tests.Transport{Index: pb.TransportType_Prefix, Transport: transport})
220-
c2p, sfp, reg := tests.SetupPhantomConnections(manager, pb.TransportType_Prefix)
221+
c2p, sfp, reg := tests.SetupPhantomConnections(manager, pb.TransportType_Prefix, nil, randomizeDstPortMinVersion)
221222
defer c2p.Close()
222223
defer sfp.Close()
223224
require.NotNil(t, reg)
@@ -296,7 +297,7 @@ func TestTryParamsToDstPort(t *testing.T) {
296297
}
297298

298299
func TestUtlsSessionResumption(t *testing.T) {
299-
// testSubnetPath := os.Getenv("GOPATH") + "/src/github.com/refraction-networking/conjure/application/lib/test/phantom_subnets.toml"
300+
// testSubnetPath := os.Getenv("GOPATH") + "/src/github.com/refraction-networking/conjure/pkg/lib/test/phantom_subnets.toml"
300301
// os.Setenv("PHANTOM_SUBNET_LOCATION", testSubnetPath)
301302

302303
// var transport Transport

0 commit comments

Comments
 (0)