From 5c4095b5d83b43e076c7d2b677600238e5b42dac Mon Sep 17 00:00:00 2001 From: V2Ray Date: Sun, 4 Oct 2015 01:06:15 +0200 Subject: [PATCH] Remove unused code --- capability.go | 36 ------------------------------------ capability_test.go | 21 --------------------- 2 files changed, 57 deletions(-) delete mode 100644 capability.go delete mode 100644 capability_test.go diff --git a/capability.go b/capability.go deleted file mode 100644 index 7b291f38c..000000000 --- a/capability.go +++ /dev/null @@ -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) -} diff --git a/capability_test.go b/capability_test.go deleted file mode 100644 index 100daeb72..000000000 --- a/capability_test.go +++ /dev/null @@ -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() -}