Documentation ¶
Overview ¶
Author: jmdvirus@roamter.com
System operation ¶
Author: jmdvirus@roamter.com
System information
Index ¶
- Constants
- Variables
- func FilterDomainOfIptables(domain string) error
- func FilterDomainRemove(domain string) error
- func IfDomainValid(domain string) bool
- func KFIPAddress() string
- func KFIPAddressName(inter string) (string, error)
- func KFLocalMac() (string, error)
- func KFMacAddress() string
- func KFParseTrafficFromString(trafficstr, port string) (int64, int64)
- func KFPortTraffic(port string) (int64, int64)
- func KFPortTrafficRouter(port string) (int64, int64)
- func KFReadAllData(filename string) []byte
- func KFServerConfig(str string) error
- func KFSetFireWall(ports []string) bool
- func KFSetFireWallRouter(ports []string, dstip string, srcport, dstport int, interf string) bool
- func KFStopFirewall()
- func SysFilterDomainDiff(filename string, data []string) bool
- func SysFilterDomainFromFiles(filename string) error
- func SysFilterDomainWriteToFile(filename string, data []string) error
- func SysProgramRunning(runshell, progName string) bool
- func SysRestartProgram(progName, args string) bool
- func SystemRun(command string, args string) bool
- func SystemRunNew(command string, args ...string) bool
- func SystemRunReturn(command string, args string) string
- func SystemRunWithReturn(command string, args ...string) string
- type KFSystemInfo
- func (si *KFSystemInfo) KFCPUInfo() float64
- func (si *KFSystemInfo) KFCPUToString() string
- func (si *KFSystemInfo) KFDiskInfo() (uint64, uint64)
- func (si *KFSystemInfo) KFDiskString() string
- func (si *KFSystemInfo) KFDiskStringM() string
- func (si *KFSystemInfo) KFMemInfo() (uint64, uint64)
- func (si *KFSystemInfo) KFSysBase() error
- func (si *KFSystemInfo) MemToString() string
- func (si *KFSystemInfo) MemToStringM() string
- type ProcessCPU
Constants ¶
const ( TotalName = "Total" FreeName = "Free" )
Someday this name will get from file with different location
Variables ¶
var LocalMac string
var Localaddr string
Functions ¶
func FilterDomainOfIptables ¶
func FilterDomainRemove ¶
func IfDomainValid ¶
func KFIPAddressName ¶
func KFLocalMac ¶
func KFMacAddress ¶
func KFMacAddress() string
Return mac address with upper chars of the first not lo one.
func KFParseTrafficFromString ¶
first return is input traffic, second return is output traffic
func KFPortTrafficRouter ¶
func KFReadAllData ¶
func KFServerConfig ¶
copy back of shadowsocks.json and restart shadowsocks.
func KFSetFireWallRouter ¶
Reset firewall with @ports Set Router mode sysctl net.ipv4.ip_forward=1 iptables -A FORWARD -d 133.130.97.109 -i eth1 -p tcp -m tcp --dport 8989 -j ACCEPT iptables -A FORWARD -d 133.130.97.109 -i eth1 -p udp -m udp --dport 8989 -j ACCEPT iptables -t nat -A PREROUTING -p tcp -m tcp --dport 8989 -j DNAT --to-destination 133.130.97.109:8989 iptables -t nat -A PREROUTING -p udp -m udp --dport 8989 -j DNAT --to-destination 133.130.97.109:8989 iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
dstip: forward to srcport: data from the port dstport: forward to port interf: check data for the interface (eth0,eth1)
func KFStopFirewall ¶
func KFStopFirewall()
func SysFilterDomainDiff ¶
func SysProgramRunning ¶
func SysRestartProgram ¶
func SystemRunNew ¶
func SystemRunReturn ¶
func SystemRunWithReturn ¶
Types ¶
type KFSystemInfo ¶
type KFSystemInfo struct { Kernel string Core string Platform string Hostname string CPUs int OSName string IPAddr string Mac string TotalRam uint64 FreeRam uint64 TotalDisk uint64 FreeDisk uint64 CPUUsage float64 }
func NewSystemInfo ¶
func NewSystemInfo() *KFSystemInfo
func (*KFSystemInfo) KFCPUToString ¶
func (si *KFSystemInfo) KFCPUToString() string
func (*KFSystemInfo) KFDiskInfo ¶
func (si *KFSystemInfo) KFDiskInfo() (uint64, uint64)
Get Disk info Return Total,Free
func (*KFSystemInfo) KFDiskString ¶
func (si *KFSystemInfo) KFDiskString() string
func (*KFSystemInfo) KFDiskStringM ¶
func (si *KFSystemInfo) KFDiskStringM() string
func (*KFSystemInfo) KFMemInfo ¶
func (si *KFSystemInfo) KFMemInfo() (uint64, uint64)
func (*KFSystemInfo) KFSysBase ¶
func (si *KFSystemInfo) KFSysBase() error
func (*KFSystemInfo) MemToString ¶
func (si *KFSystemInfo) MemToString() string
func (*KFSystemInfo) MemToStringM ¶
func (si *KFSystemInfo) MemToStringM() string