feat: update build workflow, enhance README, and modify license for version 1.4-01
Build and Release / release (push) Successful in 1m36s

This commit is contained in:
2026-06-22 11:23:22 +07:00
parent 7c3d96f1db
commit 8264f356a7
18 changed files with 417 additions and 401 deletions
+21 -5
View File
@@ -2,11 +2,13 @@ package main
import (
"context"
"crypto/tls"
"flag"
"fmt"
"io"
"log"
"net/http"
"net/url"
"os"
"os/signal"
"strings"
@@ -32,8 +34,17 @@ func rawQueryFromRequestURI(requestURI string) string {
return rawQuery
}
func parseRedirect(r string) (scheme, host string) {
if strings.Contains(r, "://") {
if u, err := url.Parse(r); err == nil && u.Host != "" {
return u.Scheme, u.Host
}
}
return "http", r
}
func main() {
redirectHost := flag.String("r", "127.0.0.1:21000", "redirect target host")
redirectHost := flag.String("r", "127.0.0.1:21000", "redirect target (host:port or full URL)")
blockedStr := flag.String("b", "", "comma separated list of blocked ports")
proxyPort := flag.Int("p", 0, "proxy listen port (default: auto)")
exePath := flag.String("e", "", "path to the executable")
@@ -41,6 +52,8 @@ func main() {
noSys := flag.Bool("no-sys", false, "skip certificate installation and system proxy setup")
flag.Parse()
redirectScheme, redirectTarget := parseRedirect(*redirectHost)
if !*noSys {
relaunched, err := relaunchWithAdminIfNeeded()
if err != nil {
@@ -119,6 +132,7 @@ func main() {
MaxIdleConnsPerHost: 100,
IdleConnTimeout: 90 * time.Second,
DisableCompression: false,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
proxy.CertStore = NewCertStorage()
proxy.OnRequest().HandleConnect(customAlwaysMitm)
@@ -171,8 +185,9 @@ func main() {
Str("raw_query", rawQuery).
Msg("Force redirect")
req.URL.Scheme = "http"
req.URL.Host = *redirectHost
req.URL.Scheme = redirectScheme
req.URL.Host = redirectTarget
req.Host = redirectTarget
req.URL.RawQuery = rawQuery
req.RequestURI = ""
zlog.Info().Str("to_url", req.URL.String()).Msg("Force redirected")
@@ -184,8 +199,9 @@ func main() {
Str("from_url", full).
Str("raw_query", rawQuery).
Msg("Redirect domain")
req.URL.Scheme = "http"
req.URL.Host = *redirectHost
req.URL.Scheme = redirectScheme
req.URL.Host = redirectTarget
req.Host = redirectTarget
req.URL.RawQuery = rawQuery
req.RequestURI = ""
zlog.Info().Str("to_url", req.URL.String()).Msg("Redirected domain")
+2 -2
View File
@@ -1,5 +1,5 @@
{
"tag": "1.3-03",
"title": "PreBuild Version 1.3 - 03"
"tag": "1.4-01",
"title": "PreBuild Version 1.4 - 01"
}