mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -05:00
comments
This commit is contained in:
parent
bf7906c7f0
commit
29d614fda5
@ -21,11 +21,17 @@ var (
|
||||
LocalHostIPv6 = IPAddress([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1})
|
||||
)
|
||||
|
||||
// AddressFamily is the type of address.
|
||||
type AddressFamily int
|
||||
|
||||
const (
|
||||
// AddressFamilyIPv4 represents address as IPv4
|
||||
AddressFamilyIPv4 = AddressFamily(0)
|
||||
|
||||
// AddressFamilyIPv6 represents address as IPv6
|
||||
AddressFamilyIPv6 = AddressFamily(1)
|
||||
|
||||
// AddressFamilyDomain represents address as Domain
|
||||
AddressFamilyDomain = AddressFamily(2)
|
||||
)
|
||||
|
||||
|
@ -11,6 +11,7 @@ type Destination struct {
|
||||
Address Address
|
||||
}
|
||||
|
||||
// DestinationFromAddr generates a Destination from a net address.
|
||||
func DestinationFromAddr(addr net.Addr) Destination {
|
||||
switch addr := addr.(type) {
|
||||
case *net.TCPAddr:
|
||||
@ -52,6 +53,7 @@ func (v Destination) IsValid() bool {
|
||||
return v.Network != Network_Unknown
|
||||
}
|
||||
|
||||
// AsDestination converts current Enpoint into Destination.
|
||||
func (v *Endpoint) AsDestination() Destination {
|
||||
return Destination{
|
||||
Network: v.Network,
|
||||
|
@ -46,7 +46,7 @@ func (v Network) URLPrefix() string {
|
||||
}
|
||||
}
|
||||
|
||||
// HashNetwork returns true if the given network is in v NetworkList.
|
||||
// HasNetwork returns true if the given network is in v NetworkList.
|
||||
func (v NetworkList) HasNetwork(network Network) bool {
|
||||
for _, value := range v.Network {
|
||||
if string(value) == string(network) {
|
||||
@ -60,6 +60,7 @@ func (v NetworkList) Get(idx int) Network {
|
||||
return v.Network[idx]
|
||||
}
|
||||
|
||||
// Size returns the number of networks in this network list.
|
||||
func (v NetworkList) Size() int {
|
||||
return len(v.Network)
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ func (v PortRange) Contains(port Port) bool {
|
||||
return v.FromPort() <= port && port <= v.ToPort()
|
||||
}
|
||||
|
||||
// SinglePortRange returns a PortRange contains a single port.
|
||||
func SinglePortRange(v Port) *PortRange {
|
||||
return &PortRange{
|
||||
From: uint32(v),
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"v2ray.com/core/common/uuid"
|
||||
)
|
||||
|
||||
// RequestCommand is a custom command in a proxy request.
|
||||
type RequestCommand byte
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user