Code Monkey home page Code Monkey logo

ipset's People

Contributors

bhesmans avatar kiyonlin avatar nvksie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ipset's Issues

🚀 使用syscall而不是进程调用实现ipset交互

🚀 使用syscall而不是进程调用实现ipset交互
go-ipset 使用了系统调用,添加大量ipset非常快而且不依赖ipset二进制文件

目前adgurad home也从包装二进制文件调用切换到系统调用了,理由就是0依赖且几十倍的速度提升

🐛 ipset.Check() has problem when version is v7+

  • version
> ipset --version
ipset v7.1, protocol version: 7
Warning: Kernel support protocol versions 6-6 while userspace supports protocol versions 6-7
  • this code will return more than version info
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
  • this code can not get real version
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
}
  • case error
ipset utility version is not supported, requiring version >= 6.0

this code can replace by regexp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.