Remove unused code

pull/40/head
V2Ray 9 years ago
parent 557f411f85
commit 5c4095b5d8

@ -1,36 +0,0 @@
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 NewCapabilities() 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)
}

@ -1,21 +0,0 @@
package core
import (
"testing"
"github.com/v2ray/v2ray-core/testing/unit"
)
func TestCapabilities(t *testing.T) {
assert := unit.Assert(t)
caps := NewCapabilities()
assert.Bool(caps.HasCapability(TCPConnection)).IsFalse()
caps.AddCapability(TCPConnection)
assert.Bool(caps.HasCapability(TCPConnection)).IsTrue()
caps.AddCapability(UDPConnection)
assert.Bool(caps.HasCapability(TCPConnection)).IsTrue()
assert.Bool(caps.HasCapability(UDPConnection)).IsTrue()
}
Loading…
Cancel
Save