mirror of
				https://github.com/nadoo/glider.git
				synced 2025-11-04 07:42:38 +08:00 
			
		
		
		
	
							parent
							
								
									55ab44fc90
								
							
						
					
					
						commit
						e3f7555032
					
				@ -213,6 +213,9 @@ VMess scheme:
 | 
				
			|||||||
  vmess://[security:]uuid@host:port[?alterID=num]
 | 
					  vmess://[security:]uuid@host:port[?alterID=num]
 | 
				
			||||||
    if alterID=0 or not set, VMessAEAD will be enabled
 | 
					    if alterID=0 or not set, VMessAEAD will be enabled
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Available securities for vmess:
 | 
				
			||||||
 | 
					  none, aes-128-gcm, chacha20-poly1305
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
VLESS scheme:
 | 
					VLESS scheme:
 | 
				
			||||||
  vless://uuid@host:port[?fallback=127.0.0.1:80]
 | 
					  vless://uuid@host:port[?fallback=127.0.0.1:80]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -224,8 +227,6 @@ Trojan server scheme:
 | 
				
			|||||||
  trojan://pass@host:port?cert=PATH&key=PATH[&fallback=127.0.0.1]
 | 
					  trojan://pass@host:port?cert=PATH&key=PATH[&fallback=127.0.0.1]
 | 
				
			||||||
  trojanc://pass@host:port[?fallback=127.0.0.1]     (cleartext, without TLS)
 | 
					  trojanc://pass@host:port[?fallback=127.0.0.1]     (cleartext, without TLS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Available securities for vmess:
 | 
					 | 
				
			||||||
  none, aes-128-gcm, chacha20-poly1305
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
TLS client scheme:
 | 
					TLS client scheme:
 | 
				
			||||||
  tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]
 | 
					  tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]
 | 
				
			||||||
 | 
				
			|||||||
@ -186,6 +186,10 @@ func usage() {
 | 
				
			|||||||
	fmt.Fprintf(w, "    if alterID=0 or not set, VMessAEAD will be enabled\n")
 | 
						fmt.Fprintf(w, "    if alterID=0 or not set, VMessAEAD will be enabled\n")
 | 
				
			||||||
	fmt.Fprintf(w, "\n")
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fmt.Fprintf(w, "Available securities for vmess:\n")
 | 
				
			||||||
 | 
						fmt.Fprintf(w, "  none, aes-128-gcm, chacha20-poly1305\n")
 | 
				
			||||||
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Fprintf(w, "VLESS scheme:\n")
 | 
						fmt.Fprintf(w, "VLESS scheme:\n")
 | 
				
			||||||
	fmt.Fprintf(w, "  vless://uuid@host:port[?fallback=127.0.0.1:80]\n")
 | 
						fmt.Fprintf(w, "  vless://uuid@host:port[?fallback=127.0.0.1:80]\n")
 | 
				
			||||||
	fmt.Fprintf(w, "\n")
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
@ -200,10 +204,6 @@ func usage() {
 | 
				
			|||||||
	fmt.Fprintf(w, "  trojanc://pass@host:port[?fallback=127.0.0.1]     (cleartext, without TLS)\n")
 | 
						fmt.Fprintf(w, "  trojanc://pass@host:port[?fallback=127.0.0.1]     (cleartext, without TLS)\n")
 | 
				
			||||||
	fmt.Fprintf(w, "\n")
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fmt.Fprintf(w, "Available securities for vmess:\n")
 | 
					 | 
				
			||||||
	fmt.Fprintf(w, "  none, aes-128-gcm, chacha20-poly1305\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[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]\n")
 | 
						fmt.Fprintf(w, "  tls://host:port[?serverName=SERVERNAME][&skipVerify=true][&cert=PATH][&alpn=proto1][&alpn=proto2]\n")
 | 
				
			||||||
	fmt.Fprintf(w, "\n")
 | 
						fmt.Fprintf(w, "\n")
 | 
				
			||||||
 | 
				
			|||||||
@ -88,6 +88,11 @@ func (r *aeadReader) read(p []byte) (int, error) {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return 0, err
 | 
							return 0, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if int(size) > len(p) {
 | 
				
			||||||
 | 
							return 0, io.EOF
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p = p[:size]
 | 
						p = p[:size]
 | 
				
			||||||
	if _, err := io.ReadFull(r.Reader, p); err != nil {
 | 
						if _, err := io.ReadFull(r.Reader, p); err != nil {
 | 
				
			||||||
		return 0, err
 | 
							return 0, err
 | 
				
			||||||
@ -106,6 +111,8 @@ func (r *aeadReader) read(p []byte) (int, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
func (r *aeadReader) Read(p []byte) (int, error) {
 | 
					func (r *aeadReader) Read(p []byte) (int, error) {
 | 
				
			||||||
	if r.buf == nil {
 | 
						if r.buf == nil {
 | 
				
			||||||
 | 
							// https://www.v2fly.org/en_US/developer/protocols/vmess.html#standard-format
 | 
				
			||||||
 | 
							// According to the spec, the maximum data length is 2^14 (chunkSize)
 | 
				
			||||||
		if len(p) >= chunkSize {
 | 
							if len(p) >= chunkSize {
 | 
				
			||||||
			return r.read(p)
 | 
								return r.read(p)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
				
			|||||||
@ -51,11 +51,3 @@ func (s *ShakeSizeParser) Encode(size uint16, b []byte) []byte {
 | 
				
			|||||||
	binary.BigEndian.PutUint16(b, mask^size)
 | 
						binary.BigEndian.PutUint16(b, mask^size)
 | 
				
			||||||
	return b[:2]
 | 
						return b[:2]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
func (s *ShakeSizeParser) NextPaddingLen() uint16 {
 | 
					 | 
				
			||||||
	return s.next() % 64
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
func (s *ShakeSizeParser) MaxPaddingLen() uint16 {
 | 
					 | 
				
			||||||
	return 64
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user