You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/capability.go

37 lines
611 B

package core
type Capability byte
const (
TCPConnection = Capability(0x01)
UDPConnection = Capability(0x02)
)
type Capabilities interface {
HasCapability(cap Capability) bool
AddCapability(cap Capability)
}
type listCapabilities struct {
data []Capability
}
func NewCapabilites() Capabilities {
return &listCapabilities{
data: make([]Capability, 0, 16),
}
}
func (c *listCapabilities) HasCapability(cap Capability) bool {
for _, v := range c.data {
if v == cap {
return true
}
}
return false
}
func (c *listCapabilities) AddCapability(cap Capability) {
c.data = append(c.data, cap)
}