github.com/xtls/xray-core@v1.8.12-0.20240518155711-3168d27b0bdb/transport/internet/sockopt.go (about) 1 package internet 2 3 func isTCPSocket(network string) bool { 4 switch network { 5 case "tcp", "tcp4", "tcp6": 6 return true 7 default: 8 return false 9 } 10 } 11 12 func isUDPSocket(network string) bool { 13 switch network { 14 case "udp", "udp4", "udp6": 15 return true 16 default: 17 return false 18 } 19 } 20 21 func (v *SocketConfig) ParseTFOValue() int { 22 if v.Tfo == 0 { 23 return -1 24 } 25 tfo := int(v.Tfo) 26 if tfo < 0 { 27 tfo = 0 28 } 29 return tfo 30 }