本文整理汇总了PHP中openvpn_port_used函数的典型用法代码示例。如果您正苦于以下问题:PHP openvpn_port_used函数的具体用法?PHP openvpn_port_used怎么用?PHP openvpn_port_used使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了openvpn_port_used函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: openvpn_port_used
if ($result = openvpn_validate_cidr($pconfig['tunnel_networkv6'], 'IPv6 Tunnel Network', false, "ipv6")) {
$input_errors[] = $result;
}
if ($result = openvpn_validate_cidr($pconfig['remote_network'], 'IPv4 Remote Network', true, "ipv4")) {
$input_errors[] = $result;
}
if ($result = openvpn_validate_cidr($pconfig['remote_networkv6'], 'IPv6 Remote Network', true, "ipv6")) {
$input_errors[] = $result;
}
if ($result = openvpn_validate_cidr($pconfig['local_network'], 'IPv4 Local Network', true, "ipv4")) {
$input_errors[] = $result;
}
if ($result = openvpn_validate_cidr($pconfig['local_networkv6'], 'IPv6 Local Network', true, "ipv6")) {
$input_errors[] = $result;
}
$portused = openvpn_port_used($pconfig['protocol'], $pconfig['interface'], $pconfig['local_port'], $vpnid);
if ($portused != $vpnid && $portused != 0) {
$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
}
if (!$tls_mode && empty($pconfig['autokey_enable'])) {
if (!strstr($pconfig['shared_key'], "-----BEGIN OpenVPN Static key V1-----") || !strstr($pconfig['shared_key'], "-----END OpenVPN Static key V1-----")) {
$input_errors[] = gettext("The field 'Shared Key' does not appear to be valid");
}
}
if ($tls_mode && !empty($pconfig['tlsauth_enable']) && empty($pconfig['autotls_enable'])) {
if (!strstr($pconfig['tls'], "-----BEGIN OpenVPN Static key V1-----") || !strstr($pconfig['tls'], "-----END OpenVPN Static key V1-----")) {
$input_errors[] = gettext("The field 'TLS Authentication Key' does not appear to be valid");
}
}
if (!empty($pconfig['dns_server1']) && !is_ipaddr(trim($pconfig['dns_server1']))) {
$input_errors[] = gettext("The field 'DNS Server #1' must contain a valid IP address");
示例2: openvpn_port_used
if (isset($id) && $a_client[$id]) {
$vpnid = $a_client[$id]['vpnid'];
} else {
$vpnid = 0;
}
if ($pconfig['mode'] != "p2p_shared_key") {
$tls_mode = true;
} else {
$tls_mode = false;
}
/* input validation */
if ($pconfig['local_port']) {
if ($result = openvpn_validate_port($pconfig['local_port'], 'Local port')) {
$input_errors[] = $result;
}
$portused = openvpn_port_used($pconfig['protocol'], $pconfig['local_port']);
if ($portused != $vpnid && $portused != 0) {
$input_errors[] = gettext("The specified 'Local port' is in use. Please select another value");
}
}
if ($result = openvpn_validate_host($pconfig['server_addr'], 'Server host or address')) {
$input_errors[] = $result;
}
if ($result = openvpn_validate_port($pconfig['server_port'], 'Server port')) {
$input_errors[] = $result;
}
if ($pconfig['proxy_addr']) {
if ($result = openvpn_validate_host($pconfig['proxy_addr'], 'Proxy host or address')) {
$input_errors[] = $result;
}
if ($result = openvpn_validate_port($pconfig['proxy_port'], 'Proxy port')) {