mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Add Version Output Support to Snowflake
From now on, there will be a file at common/version/version.go that includes current version number.
This commit is contained in:
parent
2c599f8827
commit
33248f3dec
8 changed files with 81 additions and 0 deletions
|
@ -36,3 +36,11 @@ func NameToUTLSID(name string) (utls.ClientHelloID, error) {
|
|||
}
|
||||
return utls.ClientHelloID{}, errNameNotFound
|
||||
}
|
||||
|
||||
func ListAllNames() []string {
|
||||
var names []string
|
||||
for k, _ := range clientHelloIDMap {
|
||||
names = append(names, k)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
|
24
common/utls/client_hello_id_version.go
Normal file
24
common/utls/client_hello_id_version.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package utls
|
||||
|
||||
import (
|
||||
"git.torproject.org/pluggable-transports/snowflake.git/v2/common/version"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func generateVersionOutput() string {
|
||||
var versionOutputBuilder strings.Builder
|
||||
|
||||
versionOutputBuilder.WriteString(`Known utls-imitate values:
|
||||
(empty)
|
||||
`)
|
||||
|
||||
for _, name := range ListAllNames() {
|
||||
versionOutputBuilder.WriteString(name)
|
||||
versionOutputBuilder.WriteRune('\n')
|
||||
}
|
||||
return versionOutputBuilder.String()
|
||||
}
|
||||
|
||||
func init() {
|
||||
version.AddVersionDetail(generateVersionOutput())
|
||||
}
|
5
common/version/combined.go
Normal file
5
common/version/combined.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package version
|
||||
|
||||
func ConstructResult() string {
|
||||
return GetVersion() + "\n" + GetVersionDetail()
|
||||
}
|
13
common/version/detail.go
Normal file
13
common/version/detail.go
Normal file
|
@ -0,0 +1,13 @@
|
|||
package version
|
||||
|
||||
import "strings"
|
||||
|
||||
var detailBuilder strings.Builder
|
||||
|
||||
func AddVersionDetail(detail string) {
|
||||
detailBuilder.WriteString(detail)
|
||||
}
|
||||
|
||||
func GetVersionDetail() string {
|
||||
return detailBuilder.String()
|
||||
}
|
7
common/version/version.go
Normal file
7
common/version/version.go
Normal file
|
@ -0,0 +1,7 @@
|
|||
package version
|
||||
|
||||
func GetVersion() string {
|
||||
return version
|
||||
}
|
||||
|
||||
var version = "2.3.1"
|
Loading…
Add table
Add a link
Reference in a new issue