示例#1
0
func (chk Gateway) New(params []string) (chkutil.Check, error) {
	if len(params) != 1 {
		return chk, errutil.ParameterLengthError{1, params}
	} else if !netstatus.ValidIP(params[0]) {
		return chk, errutil.ParameterTypeError{params[0], "IP"}
	}
	chk.ip = net.ParseIP(params[0])
	return chk, nil
}
示例#2
0
func (chk RoutingTableDestination) New(params []string) (chkutil.Check, error) {
	if len(params) != 1 {
		return chk, errutil.ParameterLengthError{1, params}
	}
	if !netstatus.ValidIP(params[0]) {
		return chk, errutil.ParameterTypeError{params[0], "IP address"}
	}
	chk.ip = net.ParseIP(params[0])
	return chk, nil
}
示例#3
0
func (chk IP6) New(params []string) (chkutil.Check, error) {
	if len(params) != 2 {
		return chk, errutil.ParameterLengthError{2, params}
	} else if !netstatus.ValidIP(params[1]) {
		return chk, errutil.ParameterTypeError{params[1], "IP"}
	}
	chk.name = params[0]
	chk.ip = net.ParseIP(params[1])
	return chk, nil
}