1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-25 21:36:13 -04:00

remove unused functions

This commit is contained in:
Darien Raymond 2018-11-20 16:11:55 +01:00
parent 6543f5825b
commit d1f318c82a
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 8 additions and 30 deletions

View File

@ -83,7 +83,14 @@ func (d Destination) NetAddr() string {
// String returns the strings form of this Destination.
func (d Destination) String() string {
return d.Network.URLPrefix() + ":" + d.NetAddr()
prefix := "unknown:"
switch d.Network {
case Network_TCP:
prefix = "tcp:"
case Network_UDP:
prefix = "udp:"
}
return prefix + d.NetAddr()
}
// IsValid returns true if this Destination is valid.

View File

@ -1,23 +1,5 @@
package net
import (
"strings"
)
func ParseNetwork(nwStr string) Network {
if network, found := Network_value[nwStr]; found {
return Network(network)
}
switch strings.ToLower(nwStr) {
case "tcp":
return Network_TCP
case "udp":
return Network_UDP
default:
return Network_Unknown
}
}
func (n Network) AsList() *NetworkList {
return &NetworkList{
Network: []Network{n},
@ -35,17 +17,6 @@ func (n Network) SystemString() string {
}
}
func (n Network) URLPrefix() string {
switch n {
case Network_TCP:
return "tcp"
case Network_UDP:
return "udp"
default:
return "unknown"
}
}
func HasNetwork(list []Network, network Network) bool {
for _, value := range list {
if string(value) == string(network) {