Skip to content

Commit

Permalink
upgrade deps to [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Jul 3, 2024
1 parent e8218e9 commit 1255da1
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 26 deletions.
16 changes: 14 additions & 2 deletions client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,18 @@ func main() {
log.Println("tcp:", config.TCP)
log.Println("pprof:", config.Pprof)

if config.QPP {
minSeedLength := qpp.QPPMinimumSeedLength(8)
if len(config.Key) < minSeedLength {
log.Println("QPP Warning: key size %d, required %d bytes at least", len(config.Key), minSeedLength)
}

minPads := qpp.QPPMinimumPads(8)
if config.QPPCount < minPads {
log.Println("QPP Warning: QPPCount %d, required %d at least", config.QPPCount, minPads)
}
}

// parameters check
if config.SmuxVer > maxSmuxVer {
log.Fatal("unsupported smux version:", config.SmuxVer)
Expand Down Expand Up @@ -542,7 +554,7 @@ func main() {
// create shared QPP
var _Q_ *qpp.QuantumPermutationPad
if config.QPP {
_Q_ = qpp.NewQPP(pass, uint16(config.QPPCount), QUBIT)
_Q_ = qpp.NewQPP([]byte(config.Key), uint16(config.QPPCount), QUBIT)
}

for {
Expand All @@ -565,7 +577,7 @@ func main() {
if !config.QPP {
go handleClient(muxes[idx].session, p1, config.Quiet)
} else {
go handleQPPClient(_Q_, pass, muxes[idx].session, p1, config.Quiet)
go handleQPPClient(_Q_, []byte(config.Key), muxes[idx].session, p1, config.Quiet)
}
rr++
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/urfave/cli v1.22.15
github.com/xtaci/kcp-go/v5 v5.6.8
github.com/xtaci/qpp v1.1.3
github.com/xtaci/qpp v1.1.4
github.com/xtaci/smux v1.5.24
github.com/xtaci/tcpraw v1.2.25
golang.org/x/crypto v0.24.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ github.com/xtaci/qpp v1.1.2 h1:QDJgYCtZdmKNKZ24uNPLq3cgHnp2irnJJBRtQ0gWZlU=
github.com/xtaci/qpp v1.1.2/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0=
github.com/xtaci/qpp v1.1.3 h1:mYCWbvT4c9EItrVsSD8J3KIW83zBfEQ6dZDfFs0rHZs=
github.com/xtaci/qpp v1.1.3/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0=
github.com/xtaci/qpp v1.1.4 h1:J4uUJy+7KVFWTduuIQr/MCiD9Ik8x7AblOtYbwMhC+s=
github.com/xtaci/qpp v1.1.4/go.mod h1:dJS3usaXNMbWxZSWCAdxz01UgJcz9wXDkd4BccDY/V0=
github.com/xtaci/smux v1.5.24 h1:77emW9dtnOxxOQ5ltR+8BbsX1kzcOxQ5gB+aaV9hXOY=
github.com/xtaci/smux v1.5.24/go.mod h1:OMlQbT5vcgl2gb49mFkYo6SMf+zP3rcjcwQz7ZU7IGY=
github.com/xtaci/tcpraw v1.2.25 h1:VDlqo0op17JeXBM6e2G9ocCNLOJcw9mZbobMbJjo0vk=
Expand Down
21 changes: 16 additions & 5 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
var VERSION = "SELFBUILD"

// handle multiplex-ed connection
func handleMux(_Q_ *qpp.QuantumPermutationPad, conn net.Conn, config *Config, seed []byte) {
func handleMux(_Q_ *qpp.QuantumPermutationPad, conn net.Conn, config *Config) {
// check if target is unix domain socket
var isUnix bool
if _, _, err := net.SplitHostPort(config.Target); err != nil {
Expand Down Expand Up @@ -84,7 +84,7 @@ func handleMux(_Q_ *qpp.QuantumPermutationPad, conn net.Conn, config *Config, se
if !config.QPP {
handleClient(p1, p2, config.Quiet)
} else {
handleQPPClient(_Q_, seed, p1, p2, config.Quiet)
handleQPPClient(_Q_, []byte(config.Key), p1, p2, config.Quiet)
}
}(stream)
}
Expand Down Expand Up @@ -423,6 +423,17 @@ func main() {
log.Println("quiet:", config.Quiet)
log.Println("tcp:", config.TCP)

if config.QPP {
minSeedLength := qpp.QPPMinimumSeedLength(8)
if len(config.Key) < minSeedLength {
log.Println("QPP Warning: key size %d, required %d bytes at least", len(config.Key), minSeedLength)
}

minPads := qpp.QPPMinimumPads(8)
if config.QPPCount < minPads {
log.Println("QPP Warning: QPPCount %d, required %d at least", config.QPPCount, minPads)
}
}
// parameters check
if config.SmuxVer > maxSmuxVer {
log.Fatal("unsupported smux version:", config.SmuxVer)
Expand Down Expand Up @@ -472,7 +483,7 @@ func main() {
// create shared QPP
var _Q_ *qpp.QuantumPermutationPad
if config.QPP {
_Q_ = qpp.NewQPP(pass, uint16(config.QPPCount), QUBIT)
_Q_ = qpp.NewQPP([]byte(config.Key), uint16(config.QPPCount), QUBIT)
}

// main loop
Expand Down Expand Up @@ -500,9 +511,9 @@ func main() {
conn.SetACKNoDelay(config.AckNodelay)

if config.NoComp {
go handleMux(_Q_, conn, &config, pass)
go handleMux(_Q_, conn, &config)
} else {
go handleMux(_Q_, generic.NewCompStream(conn), &config, pass)
go handleMux(_Q_, generic.NewCompStream(conn), &config)
}
} else {
log.Printf("%+v", err)
Expand Down
103 changes: 86 additions & 17 deletions vendor/github.com/xtaci/qpp/qpp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ github.com/urfave/cli
# github.com/xtaci/kcp-go/v5 v5.6.8
## explicit; go 1.21
github.com/xtaci/kcp-go/v5
# github.com/xtaci/qpp v1.1.3
# github.com/xtaci/qpp v1.1.4
## explicit; go 1.22.3
github.com/xtaci/qpp
# github.com/xtaci/smux v1.5.24
Expand Down

0 comments on commit 1255da1

Please sign in to comment.