mirror of
				https://github.com/nadoo/glider.git
				synced 2025-10-31 22:05:51 +08:00 
			
		
		
		
	vmess: support zero security
This commit is contained in:
		
							parent
							
								
									39ae201afe
								
							
						
					
					
						commit
						a529261893
					
				| @ -213,8 +213,8 @@ VMess scheme: | ||||
|   vmess://[security:]uuid@host:port[?alterID=num] | ||||
|     if alterID=0 or not set, VMessAEAD will be enabled | ||||
| 
 | ||||
| Available securities for vmess: | ||||
|   none, aes-128-gcm, chacha20-poly1305 | ||||
| Available security for vmess: | ||||
|   zero, none, aes-128-gcm, chacha20-poly1305 | ||||
|    | ||||
| VLESS scheme: | ||||
|   vless://uuid@host:port[?fallback=127.0.0.1:80] | ||||
|  | ||||
| @ -186,8 +186,8 @@ func usage() { | ||||
| 	fmt.Fprintf(w, "    if alterID=0 or not set, VMessAEAD will be enabled\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, "Available security for vmess:\n") | ||||
| 	fmt.Fprintf(w, "  zero, none, aes-128-gcm, chacha20-poly1305\n") | ||||
| 	fmt.Fprintf(w, "\n") | ||||
| 
 | ||||
| 	fmt.Fprintf(w, "VLESS scheme:\n") | ||||
|  | ||||
							
								
								
									
										2
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.go
									
									
									
									
									
								
							| @ -18,7 +18,7 @@ import ( | ||||
| ) | ||||
| 
 | ||||
| var ( | ||||
| 	version = "0.15.2" | ||||
| 	version = "0.15.3" | ||||
| 	config  = parseConfig() | ||||
| ) | ||||
| 
 | ||||
|  | ||||
| @ -27,7 +27,7 @@ const ( | ||||
| 	OptBasicFormat byte = 0 | ||||
| 	OptChunkStream byte = 1 | ||||
| 	// OptReuseTCPConnection byte = 2
 | ||||
| 	OptMetadataObfuscate byte = 4 | ||||
| 	OptChunkMasking byte = 4 | ||||
| ) | ||||
| 
 | ||||
| // Security types
 | ||||
| @ -93,7 +93,7 @@ func NewClient(uuidStr, security string, alterID int, aead bool) (*Client, error | ||||
| 	c.users = append(c.users, user.GenAlterIDUsers(alterID)...) | ||||
| 	c.count = len(c.users) | ||||
| 
 | ||||
| 	c.opt = OptChunkStream | OptMetadataObfuscate | ||||
| 	c.opt = OptChunkStream | OptChunkMasking | ||||
| 	c.aead = aead | ||||
| 
 | ||||
| 	security = strings.ToLower(security) | ||||
| @ -104,6 +104,9 @@ func NewClient(uuidStr, security string, alterID int, aead bool) (*Client, error | ||||
| 		c.security = SecurityChacha20Poly1305 | ||||
| 	case "none": | ||||
| 		c.security = SecurityNone | ||||
| 	case "zero": | ||||
| 		c.security = SecurityNone | ||||
| 		c.opt = OptBasicFormat | ||||
| 	case "": | ||||
| 		c.security = SecurityChacha20Poly1305 | ||||
| 		if runtime.GOARCH == "amd64" || runtime.GOARCH == "s390x" || runtime.GOARCH == "arm64" { | ||||
|  | ||||
| @ -99,7 +99,7 @@ func handleDHCP(serverIP net.IP, mask net.IPMask, pool *Pool) server4.Handler { | ||||
| 			return | ||||
| 		} | ||||
| 
 | ||||
| 		replyIp, err := pool.LeaseIP(m.ClientHWAddr) | ||||
| 		replyIP, err := pool.LeaseIP(m.ClientHWAddr) | ||||
| 		if err != nil { | ||||
| 			log.F("[dpcpd] can not assign IP, error %s", err) | ||||
| 			return | ||||
| @ -109,7 +109,7 @@ func handleDHCP(serverIP net.IP, mask net.IPMask, pool *Pool) server4.Handler { | ||||
| 			dhcpv4.WithMessageType(replyType), | ||||
| 			dhcpv4.WithServerIP(serverIP), | ||||
| 			dhcpv4.WithNetmask(mask), | ||||
| 			dhcpv4.WithYourIP(replyIp), | ||||
| 			dhcpv4.WithYourIP(replyIP), | ||||
| 			dhcpv4.WithRouter(serverIP), | ||||
| 			dhcpv4.WithDNS(serverIP), | ||||
| 			// RFC 2131, Section 4.3.1. Server Identifier: MUST
 | ||||
| @ -131,7 +131,7 @@ func handleDHCP(serverIP net.IP, mask net.IPMask, pool *Pool) server4.Handler { | ||||
| 			return | ||||
| 		} | ||||
| 
 | ||||
| 		log.F("[dpcpd] lease %v to client %v", replyIp, reply.ClientHWAddr) | ||||
| 		log.F("[dpcpd] lease %v to client %v", replyIP, reply.ClientHWAddr) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 nadoo
						nadoo