-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from wolf-joe/ipv6_ipset
support ipv6 ipset
- Loading branch information
Showing
5 changed files
with
85 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package outbound | ||
|
||
import "github.com/wolf-joe/go-ipset/ipset" | ||
|
||
type iIPSet interface { | ||
Add(entry string, timeout int) error | ||
GetName() string | ||
GetTimeout() int | ||
} | ||
|
||
type ipSetWrapper struct { | ||
*ipset.IPSet | ||
} | ||
|
||
func (i ipSetWrapper) GetName() string { return i.Name } | ||
func (i ipSetWrapper) GetTimeout() int { return i.Timeout } | ||
|
||
var ( | ||
_ iIPSet = ipSetWrapper{} | ||
_ iIPSet = MockIPSet{} | ||
) | ||
|
||
type MockIPSet struct { | ||
Name string | ||
Timeout int | ||
MockAdd func(entry string, timeout int) error | ||
} | ||
|
||
func (i MockIPSet) GetName() string { return i.Name } | ||
func (i MockIPSet) GetTimeout() int { return i.Timeout } | ||
func (i MockIPSet) Add(entry string, timeout int) error { return i.MockAdd(entry, timeout) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters