gonetx / ipset Goto Github PK
View Code? Open in Web Editor NEWGolang wrapper of ipset.
License: Apache License 2.0
Golang wrapper of ipset.
License: Apache License 2.0
🚀 使用syscall而不是进程调用实现ipset交互
go-ipset 使用了系统调用,添加大量ipset非常快而且不依赖ipset二进制文件
目前adgurad home也从包装二进制文件调用切换到系统调用了,理由就是0依赖且几十倍的速度提升
> ipset --version
ipset v7.1, protocol version: 7
Warning: Kernel support protocol versions 6-6 while userspace supports protocol versions 6-7
out, err := execCommand(ipsetPath, _version).CombinedOutput()
# out is like this
Warning: Kernel support protocol versions 6-6 while userspace supports protocol versions 6-7
ipset v7.1, protocol version: 7
func getMajorVersion(version []byte) int {
vIndex := bytes.IndexByte(version, 'v')
dotIndex := bytes.IndexByte(version, '.')
var majorVersion int
for i := vIndex + 1; i < dotIndex; i++ {
if c := version[i]; c >= '0' && c <= '9' {
majorVersion = majorVersion*10 + int(c-'0')
} else {
return 0
}
}
return majorVersion
}
ipset utility version is not supported, requiring version >= 6.0
this code can replace by regexp
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.