Skip to content

Commit 51eb50d

Browse files
author
uoosef
committed
implement session
1 parent 0b579cc commit 51eb50d

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Config struct {
2828
DelayBetweenChunks [2]int `mapstructure:"DelayBetweenChunks"`
2929
Hosts []resolve.Hosts `mapstructure:"Hosts"`
3030
ResolveSystem string `mapstructure:"-"`
31+
UserSession string `mapstructure:"-"`
3132
}
3233

3334
var G *Config

server/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"context"
1313
"fmt"
1414
"io"
15+
"math/rand"
1516
"os"
1617
"os/signal"
1718
"strings"
@@ -22,6 +23,7 @@ import (
2223
var s5 *socks5.Server
2324

2425
func Run(captureCTRLC bool) error {
26+
config.G.UserSession = fmt.Sprintf("%08d", rand.Intn(1000))
2527
appCache := utils.NewCache(time.Duration(config.G.DnsCacheTTL) * time.Second)
2628

2729
var resolveSystem string

utils/helper.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package utils
33

44
import (
5+
"bepass/config"
56
"fmt"
67
"net"
78
"net/url"
@@ -22,6 +23,6 @@ func WSEndpointHelper(workerAddress, rawDestAddress, network string) (string, er
2223
if err != nil {
2324
return "", err
2425
}
25-
endpoint := fmt.Sprintf("wss://%s/connect?host=%s&port=%s&net=%s", u.Host, dh, dp, network)
26+
endpoint := fmt.Sprintf("wss://%s/connect?host=%s&port=%s&net=%s&session=%s", u.Host, dh, dp, network, config.G.UserSession)
2627
return endpoint, nil
2728
}

0 commit comments

Comments
 (0)