Documentation ¶
Index ¶
- Constants
- func IPv4StrToUint32(ipStr string) (uint32, error)
- func IPv4ToUint32(ipBytes net.IP) (uint32, error)
- func InRange(r IpRange, ip net.IP) bool
- func IsIPv4Address(input string) bool
- func IsPrivateIp(input string) bool
- func ParseIPv4(s string) net.IP
- func Uint32ToIPv4(ipNum uint32) net.IP
- func Uint32ToIPv4Str(ipNum uint32) string
- type AclTable
- type IpRange
Constants ¶
View Source
const (
ACL_NOT_FOUND = "acl_not_found" // it is used when clientip is not found in acl table
)
Variables ¶
This section is empty.
Functions ¶
func IPv4StrToUint32 ¶
IPv4StrToUint32 convert IPv4 string to uint32
e.g., "1.2.3.4" to 0x01020304
Params:
- ipStr: IPv4 addr in string
Returns:
IPv4 addr in uint32
func IPv4ToUint32 ¶
IPv4ToUint32 convert net.IP to uint32
e.g., 1.2.3.4 to 0x01020304
Params:
- ipBytes: IPv4 addr in net.IP
Returns:
IPv4 addr in uint32
func IsIPv4Address ¶
IsIPv4Address Check input is ipv4 address or not.
param:
- input: a string
return:
bool
func IsPrivateIp ¶
IsPrivateIp Check to see if an ip is in a private subnet.
param:
- input: an ip string
return:
bool
func ParseIPv4 ¶
ParseIPv4 parse IP addr from string to net.IP
Params:
- s: IP addr in string, e.g., "1.2.3.4"
Returns:
IP addr in net.IP
func Uint32ToIPv4 ¶
Uint32ToIPv4 convert uint32 net.IP
e.g., 0x01020304 to 1.2.3.4
Params:
- ipNum: IPv4 addr in uint32
Returns:
IPv4 addr in net.IP
func Uint32ToIPv4Str ¶
Uint32ToIPv4Str convert uint32 to str
e.g., 0x01020304 to "1.2.3.4"
Params:
- ipNum: IPv4 addr in uint32
Returns:
IPv4 addr in string
Types ¶
type AclTable ¶
type AclTable struct {
// contains filtered or unexported fields
}
func NewAclTable ¶
func NewAclTable() *AclTable
func (*AclTable) GetAclName ¶
Click to show internal directories.
Click to hide internal directories.