Release 0.10.11 (#195)

* chore: increase the length of traceId token

* fix: size of string builder for trace id

* chore: rename --no-banner to --banner

* chore: update docs

* chore: prepare for next release
This commit is contained in:
xvzc 2024-08-25 18:09:58 +09:00 committed by GitHub
parent d397d30fb5
commit f8f740b0cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 24 additions and 20 deletions

View File

@ -59,6 +59,8 @@ $ go build ./cmd/...
Usage: spoof-dpi [options...] Usage: spoof-dpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -67,8 +69,6 @@ Usage: spoof-dpi [options...]
port number for dns (default 53) port number for dns (default 53)
-enable-doh -enable-doh
enable 'dns-over-https' enable 'dns-over-https'
-no-banner
disable banner
-pattern value -pattern value
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int

View File

@ -56,6 +56,8 @@ $ go build ./cmd/...
Usage: spoof-dpi [options...] Usage: spoof-dpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -64,8 +66,6 @@ Usage: spoof-dpi [options...]
port number for dns (default 53) port number for dns (default 53)
-enable-doh -enable-doh
enable 'dns-over-https' enable 'dns-over-https'
-no-banner
disable banner
-pattern value -pattern value
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int

View File

@ -54,6 +54,8 @@ $ go install github.com/xvzc/SpoofDPI/cmd/spoof-dpi@latest
Usage: spoof-dpi [options...] Usage: spoof-dpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -62,8 +64,6 @@ Usage: spoof-dpi [options...]
port number for dns (default 53) port number for dns (default 53)
-enable-doh -enable-doh
enable 'dns-over-https' enable 'dns-over-https'
-no-banner
disable banner
-pattern value -pattern value
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int

View File

@ -58,6 +58,8 @@ $ go build ./cmd/...
Usage: spoof-dpi [опции...] Usage: spoof-dpi [опции...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -66,8 +68,6 @@ Usage: spoof-dpi [опции...]
port number for dns (default 53) port number for dns (default 53)
-enable-doh -enable-doh
enable 'dns-over-https' enable 'dns-over-https'
-no-banner
disable banner
-pattern value -pattern value
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int

View File

@ -63,6 +63,8 @@ $ go build ./cmd/...
Usage: spoof-dpi [options...] Usage: spoof-dpi [options...]
-addr string -addr string
listen address (default "127.0.0.1") listen address (default "127.0.0.1")
-banner
enable banner (default true)
-debug -debug
enable debug output enable debug output
-dns-addr string -dns-addr string
@ -71,8 +73,6 @@ Usage: spoof-dpi [options...]
port number for dns (default 53) port number for dns (default 53)
-enable-doh -enable-doh
enable 'dns-over-https' enable 'dns-over-https'
-no-banner
disable banner
-pattern value -pattern value
bypass DPI only on packets matching this regex pattern; can be given multiple times bypass DPI only on packets matching this regex pattern; can be given multiple times
-port int -port int

View File

@ -29,10 +29,10 @@ func main() {
pxy := proxy.New(config) pxy := proxy.New(config)
if config.NoBanner { if config.Banner {
util.PrintSimpleInfo()
} else {
util.PrintColoredBanner() util.PrintColoredBanner()
} else {
util.PrintSimpleInfo()
} }
if config.SystemProxy { if config.SystemProxy {

View File

@ -12,7 +12,7 @@ type Args struct {
DnsPort int DnsPort int
EnableDoh bool EnableDoh bool
Debug bool Debug bool
NoBanner bool Banner bool
SystemProxy bool SystemProxy bool
Timeout int Timeout int
AllowedPattern StringArray AllowedPattern StringArray
@ -40,7 +40,7 @@ func ParseArgs() *Args {
flag.IntVar(&args.DnsPort, "dns-port", 53, "port number for dns") flag.IntVar(&args.DnsPort, "dns-port", 53, "port number for dns")
flag.BoolVar(&args.EnableDoh, "enable-doh", false, "enable 'dns-over-https'") flag.BoolVar(&args.EnableDoh, "enable-doh", false, "enable 'dns-over-https'")
flag.BoolVar(&args.Debug, "debug", false, "enable debug output") flag.BoolVar(&args.Debug, "debug", false, "enable debug output")
flag.BoolVar(&args.NoBanner, "no-banner", false, "disable banner") flag.BoolVar(&args.Banner, "banner", true, "enable banner")
flag.BoolVar(&args.SystemProxy, "system-proxy", true, "enable system-wide proxy") flag.BoolVar(&args.SystemProxy, "system-proxy", true, "enable system-wide proxy")
flag.IntVar(&args.Timeout, "timeout", 0, "timeout in milliseconds; no timeout when not given") flag.IntVar(&args.Timeout, "timeout", 0, "timeout in milliseconds; no timeout when not given")
flag.IntVar(&args.WindowSize, "window-size", 0, `chunk size, in number of bytes, for fragmented client hello, flag.IntVar(&args.WindowSize, "window-size", 0, `chunk size, in number of bytes, for fragmented client hello,

View File

@ -15,7 +15,7 @@ type Config struct {
DnsPort int DnsPort int
EnableDoh bool EnableDoh bool
Debug bool Debug bool
NoBanner bool Banner bool
SystemProxy bool SystemProxy bool
Timeout int Timeout int
WindowSize int WindowSize int
@ -38,7 +38,7 @@ func (c *Config) Load(args *Args) {
c.DnsPort = args.DnsPort c.DnsPort = args.DnsPort
c.Debug = args.Debug c.Debug = args.Debug
c.EnableDoh = args.EnableDoh c.EnableDoh = args.EnableDoh
c.NoBanner = args.NoBanner c.Banner = args.Banner
c.SystemProxy = args.SystemProxy c.SystemProxy = args.SystemProxy
c.Timeout = args.Timeout c.Timeout = args.Timeout
c.AllowedPatterns = parseAllowedPattern(args.AllowedPattern) c.AllowedPatterns = parseAllowedPattern(args.AllowedPattern)
@ -66,6 +66,8 @@ func PrintColoredBanner() {
{Level: 0, Text: "DNS : " + fmt.Sprint(config.DnsAddr)}, {Level: 0, Text: "DNS : " + fmt.Sprint(config.DnsAddr)},
{Level: 0, Text: "DEBUG : " + fmt.Sprint(config.Debug)}, {Level: 0, Text: "DEBUG : " + fmt.Sprint(config.Debug)},
}).Render() }).Render()
pterm.DefaultBasicText.Println("Press 'CTRL + c to quit'")
} }
func PrintSimpleInfo() { func PrintSimpleInfo() {
@ -75,4 +77,6 @@ func PrintSimpleInfo() {
fmt.Println("- DNS : ", config.DnsAddr) fmt.Println("- DNS : ", config.DnsAddr)
fmt.Println("- DEBUG : ", config.Debug) fmt.Println("- DEBUG : ", config.Debug)
fmt.Println("") fmt.Println("")
fmt.Println("Press 'CTRL + c to quit'")
fmt.Println("")
} }

View File

@ -34,7 +34,7 @@ func GetTraceIdFromCtx(ctx context.Context) (string, bool) {
func generateTraceId() string { func generateTraceId() string {
sb := strings.Builder{} sb := strings.Builder{}
sb.Grow(22) sb.Grow(35)
var q uint64 var q uint64
var r uint8 var r uint8
@ -47,7 +47,7 @@ func generateTraceId() string {
r += 0x27 r += 0x27
} }
sb.WriteByte(r + 0x30) sb.WriteByte(r + 0x30)
if i&3 == 3 && i != 31 { if i&7 == 7 && i != 31 {
sb.WriteByte(0x2D) sb.WriteByte(0x2D)
} }
} }

View File

@ -1 +1 @@
0.10.10 0.10.11