Files
v2ray_simple/netLayer/const.go

34 lines
726 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package netLayer
const (
// Transport Layer Protocols, 使用uint16 mask所以最多支持16种
TCP uint16 = 1 << iota
UDP
UNIX //unix domain socket
Raw_socket
KCP
Quic //quic是一个横跨多个层的协议这里也算一个毕竟与kcp类似
//一般而言我们除了tcp和udp的协议只用于出口不用于入口
//不过,如果是多级代理串联的话,也会碰到需要 kcp等流量作为入口等情况。
)
func StrToTransportProtocol(s string) uint16 {
switch s {
case "tcp", "tcp4", "tcp6":
return TCP
case "udp", "udp4", "udp6":
return UDP
case "unix":
return UNIX
case "raw":
return Raw_socket
case "kcp":
return KCP
case "quic":
return Quic
}
return 0
}