Пример #1
0
func NewPort(sysPort system.Port) *Port {
	port := sysPort.Port()
	listening, _ := sysPort.Listening()
	ip, _ := sysPort.IP()
	return &Port{
		Port:      port,
		Listening: listening.(bool),
		IP:        ip.(string),
	}
}
Пример #2
0
func NewPort(sysPort system.Port, config util.Config) (*Port, error) {
	port := sysPort.Port()
	listening, _ := sysPort.Listening()
	p := &Port{
		Port:      port,
		Listening: listening.(bool),
	}
	if !contains(config.IgnoreList, "ip") {
		ip, _ := sysPort.IP()
		p.IP = ip
	}
	return p, nil
}
Пример #3
0
func NewPort(sysPort system.Port, ignoreList []string) *Port {
	port := sysPort.Port()
	listening, _ := sysPort.Listening()
	p := &Port{
		Port:      port,
		Listening: listening.(bool),
	}
	if !contains(ignoreList, "ip") {
		ip, _ := sysPort.IP()
		p.IP = ip.(string)
	}
	return p
}