@@ -34,6 +34,8 @@ type TunnelConfig struct {
3434 PoolType string // 池类型 (0-TCP, 1-QUIC, 2-WebSocket, 3-HTTP/2)
3535 Dial string // 出站源IP地址
3636 Dns string // DNS服务器地址
37+ Sni string // SNI服务器名称指示
38+ Block string // 协议屏蔽 (0-禁用, 1-SOCKS, 2-HTTP, 3-TLS)
3739}
3840
3941// ParseTunnelURL 解析隧道实例 URL 并返回 Tunnel 模型
@@ -244,6 +246,13 @@ func ParseTunnelURL(rawURL string) *models.Tunnel {
244246 if poolType , err := strconv .Atoi (val ); err == nil && poolType >= 0 && poolType <= 3 {
245247 tunnel .PoolType = & poolType
246248 }
249+ case "sni" :
250+ tunnel .Sni = & val
251+ case "block" :
252+ // 协议屏蔽 (0=禁用, 1=SOCKS, 2=HTTP, 3=TLS)
253+ if blockType , err := strconv .Atoi (val ); err == nil && blockType >= 0 && blockType <= 3 {
254+ tunnel .Block = & blockType
255+ }
247256 }
248257 }
249258 }
@@ -378,6 +387,12 @@ func TunnelToMap(tunnel *models.Tunnel) map[string]interface{} {
378387 if tunnel .Dns != nil {
379388 updates ["dns" ] = tunnel .Dns
380389 }
390+ if tunnel .Sni != nil {
391+ updates ["sni" ] = tunnel .Sni
392+ }
393+ if tunnel .Block != nil {
394+ updates ["block" ] = tunnel .Block
395+ }
381396 return updates
382397}
383398
@@ -456,6 +471,8 @@ func ParseTunnelConfig(rawURL string) *TunnelConfig {
456471 noTCP := query .Get ("notcp" )
457472 noUDP := query .Get ("noudp" )
458473 cfg .Dns = query .Get ("dns" )
474+ cfg .Sni = query .Get ("sni" )
475+ cfg .Block = query .Get ("block" )
459476
460477 // 根据notcp和noudp参数的组合来设置listenType
461478 if noTCP != "" || noUDP != "" {
@@ -584,6 +601,12 @@ func (c *TunnelConfig) BuildTunnelConfigURL() string {
584601 if c .Dns != "" {
585602 queryParams = append (queryParams , fmt .Sprintf ("dns=%s" , c .Dns ))
586603 }
604+ if c .Sni != "" {
605+ queryParams = append (queryParams , fmt .Sprintf ("sni=%s" , c .Sni ))
606+ }
607+ if c .Block != "" {
608+ queryParams = append (queryParams , fmt .Sprintf ("block=%s" , c .Block ))
609+ }
587610
588611 // 根据listenType生成notcp和noudp参数
589612 if c .ListenType != "" {
@@ -766,6 +789,12 @@ func BuildTunnelURLs(tunnel models.Tunnel) string {
766789 if tunnel .PoolType != nil {
767790 queryParams = append (queryParams , fmt .Sprintf ("type=%d" , * tunnel .PoolType ))
768791 }
792+ if tunnel .Sni != nil && * tunnel .Sni != "" {
793+ queryParams = append (queryParams , fmt .Sprintf ("sni=%s" , * tunnel .Sni ))
794+ }
795+ if tunnel .Block != nil {
796+ queryParams = append (queryParams , fmt .Sprintf ("block=%d" , * tunnel .Block ))
797+ }
769798
770799 if tunnel .ProxyProtocol != nil {
771800 proxyVal := "0"
0 commit comments