add rate limiter

This commit is contained in:
ginuerzh
2022-09-05 22:47:51 +08:00
parent e23da0f319
commit 4c2131ca6d
40 changed files with 1622 additions and 135 deletions

View File

@ -1,5 +1,28 @@
package net
import (
"net"
"syscall"
)
type SetBuffer interface {
SetReadBuffer(bytes int) error
SetWriteBuffer(bytes int) error
}
type SyscallConn interface {
SyscallConn() (syscall.RawConn, error)
}
type RemoteAddr interface {
RemoteAddr() net.Addr
}
// tcpraw.TCPConn
type SetDSCP interface {
SetDSCP(int) error
}
func IsIPv4(address string) bool {
return address != "" && address[0] != ':' && address[0] != '['
}