Skip to content

Commit

Permalink
Improve randomization of hostname for TLS connections
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-markowicz committed Nov 11, 2022
1 parent 13a11e9 commit bcf344b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions conn/tcp_tls_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ type TunSafeData struct {
wgRecvCount uint64
}

var topLevelDomains = []string{"com", "net", "org", "it", "fr", "me", "us", "ru", "cn", "es", "tr"}
var domains = []string{"google", "apple", "netflix", "dropbox", "spotify", "ubs", "css", "github", "gitlab", "ibm", "pictet", "tesla", "spacex", "sonarqube", "jenkins", "acme", "novartis", "nestle", "monsanto", "vitol"}
var topLevelDomains = []string{"com", "net", "org", "it", "fr", "me", "ru", "cn", "es", "tr", "top", "xyz", "info"}

func NewTunSafeData() *TunSafeData {
return &TunSafeData{
Expand Down Expand Up @@ -153,7 +152,13 @@ func wgToTunSafeData(wgPacket []byte) []byte {
}

func randomServerName() string {
return randItem(domains) + "." + randItem(topLevelDomains)
charNum := int('z') - int('a') + 1
size := 3 + randInt(10)
name := make([]byte, size)
for i := range name {
name[i] = byte(int('a') + randInt(charNum))
}
return string(name) + "." + randItem(topLevelDomains)
}

func randItem(list []string) string {
Expand Down

0 comments on commit bcf344b

Please sign in to comment.