mirror of
				https://github.com/nadoo/glider.git
				synced 2025-11-04 15:52:38 +08:00 
			
		
		
		
	tls: support customization of serverName (#169)
This commit is contained in:
		
							parent
							
								
									92a43608f3
								
							
						
					
					
						commit
						e23a29f057
					
				@ -90,7 +90,7 @@ glider -h
 | 
				
			|||||||
<summary>click to see details</summary>
 | 
					<summary>click to see details</summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```bash
 | 
					```bash
 | 
				
			||||||
glider 0.10.0 usage:
 | 
					glider 0.10.1 usage:
 | 
				
			||||||
  -checkdisabledonly
 | 
					  -checkdisabledonly
 | 
				
			||||||
    	check disabled fowarders only
 | 
					    	check disabled fowarders only
 | 
				
			||||||
  -checkinterval int
 | 
					  -checkinterval int
 | 
				
			||||||
@ -170,10 +170,10 @@ Available securities for vmess:
 | 
				
			|||||||
  none, aes-128-gcm, chacha20-poly1305
 | 
					  none, aes-128-gcm, chacha20-poly1305
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TLS client scheme:
 | 
					TLS client scheme:
 | 
				
			||||||
  tls://host:port[?skipVerify=true]
 | 
					  tls://host:port[?skipVerify=true][&serverName=SERVERNAME]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Proxy over tls client:
 | 
					Proxy over tls client:
 | 
				
			||||||
  tls://host:port[?skipVerify=true],scheme://
 | 
					  tls://host:port[?skipVerify=true][&serverName=SERVERNAME],scheme://
 | 
				
			||||||
  tls://host:port[?skipVerify=true],http://[user:pass@]
 | 
					  tls://host:port[?skipVerify=true],http://[user:pass@]
 | 
				
			||||||
  tls://host:port[?skipVerify=true],socks5://[user:pass@]
 | 
					  tls://host:port[?skipVerify=true],socks5://[user:pass@]
 | 
				
			||||||
  tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num
 | 
					  tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num
 | 
				
			||||||
@ -197,7 +197,7 @@ Websocket with a specified proxy protocol:
 | 
				
			|||||||
  ws://host:port[/path][?host=HOST],vmess://[security:]uuid@?alterID=num
 | 
					  ws://host:port[/path][?host=HOST],vmess://[security:]uuid@?alterID=num
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TLS and Websocket with a specified proxy protocol:
 | 
					TLS and Websocket with a specified proxy protocol:
 | 
				
			||||||
  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],scheme://
 | 
					  tls://host:port[?skipVerify=true][&serverName=SERVERNAME],ws://[@/path[?host=HOST]],scheme://
 | 
				
			||||||
  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]
 | 
					  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]
 | 
				
			||||||
  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]
 | 
					  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]
 | 
				
			||||||
  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num
 | 
					  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								conf.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								conf.go
									
									
									
									
									
								
							@ -154,11 +154,11 @@ func usage() {
 | 
				
			|||||||
	fmt.Fprintf(w, "\n")
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Fprintf(w, "TLS client scheme:\n")
 | 
						fmt.Fprintf(w, "TLS client scheme:\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true]\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true][&serverName=SERVERNAME]\n")
 | 
				
			||||||
	fmt.Fprintf(w, "\n")
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Fprintf(w, "Proxy over tls client:\n")
 | 
						fmt.Fprintf(w, "Proxy over tls client:\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],scheme://\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true][&serverName=SERVERNAME],scheme://\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],http://[user:pass@]\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],http://[user:pass@]\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],socks5://[user:pass@]\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],socks5://[user:pass@]\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],vmess://[security:]uuid@?alterID=num\n")
 | 
				
			||||||
@ -187,7 +187,7 @@ func usage() {
 | 
				
			|||||||
	fmt.Fprintf(w, "\n")
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Fprintf(w, "TLS and Websocket with a specified proxy protocol:\n")
 | 
						fmt.Fprintf(w, "TLS and Websocket with a specified proxy protocol:\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],scheme://\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true][&serverName=SERVERNAME],ws://[@/path[?host=HOST]],scheme://\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],http://[user:pass@]\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],socks5://[user:pass@]\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?skipVerify=true],ws://[@/path[?host=HOST]],vmess://[security:]uuid@?alterID=num\n")
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								go.mod
									
									
									
									
									
								
							@ -15,7 +15,7 @@ require (
 | 
				
			|||||||
	golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
 | 
						golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
 | 
				
			||||||
	golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
 | 
						golang.org/x/net v0.0.0-20200707034311-ab3426394381 // indirect
 | 
				
			||||||
	golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
 | 
						golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
 | 
				
			||||||
	golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed // indirect
 | 
						golang.org/x/tools v0.0.0-20200713235242-6acd2ab80ede // indirect
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Replace dependency modules with local developing copy
 | 
					// Replace dependency modules with local developing copy
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.sum
									
									
									
									
									
								
							@ -111,8 +111,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 | 
				
			|||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 | 
					golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
 | 
				
			||||||
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c h1:iHhCR0b26amDCiiO+kBguKZom9aMF+NrFxh9zeKR/XU=
 | 
					golang.org/x/tools v0.0.0-20200425043458-8463f397d07c h1:iHhCR0b26amDCiiO+kBguKZom9aMF+NrFxh9zeKR/XU=
 | 
				
			||||||
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 | 
					golang.org/x/tools v0.0.0-20200425043458-8463f397d07c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
 | 
				
			||||||
golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed h1:+qzWo37K31KxduIYaBeMqJ8MUOyTayOQKpH9aDPLMSY=
 | 
					golang.org/x/tools v0.0.0-20200713235242-6acd2ab80ede h1:ItmFoZpZfJTYGsnON6247QuXEOKiKLBpieGcAgweGsk=
 | 
				
			||||||
golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 | 
					golang.org/x/tools v0.0.0-20200713235242-6acd2ab80ede/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
 | 
				
			||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
					golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
				
			||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
					golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
 | 
				
			||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
 | 
					golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.go
									
									
									
									
									
								
							@ -33,7 +33,7 @@ import (
 | 
				
			|||||||
	_ "github.com/nadoo/glider/proxy/ws"
 | 
						_ "github.com/nadoo/glider/proxy/ws"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var version = "0.10.0"
 | 
					var version = "0.10.1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
	// read configs
 | 
						// read configs
 | 
				
			||||||
 | 
				
			|||||||
@ -55,6 +55,10 @@ func NewTLS(s string, d proxy.Dialer, p proxy.Proxy) (*TLS, error) {
 | 
				
			|||||||
	certFile := query.Get("cert")
 | 
						certFile := query.Get("cert")
 | 
				
			||||||
	keyFile := query.Get("key")
 | 
						keyFile := query.Get("key")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if customServer := query.Get("serverName"); customServer != "" {
 | 
				
			||||||
 | 
							serverName = customServer
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	t := &TLS{
 | 
						t := &TLS{
 | 
				
			||||||
		dialer:     d,
 | 
							dialer:     d,
 | 
				
			||||||
		proxy:      p,
 | 
							proxy:      p,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user