def _decide_type(self, user): ip = user['virtual_ip'] if is_ip_in_range(ip, self.pptp_ip_range): return 'pptp' elif is_ip_in_range(ip, self.l2tp_ip_range): return 'l2tp' else: return 'ppp'
def is_l2tp_ip(ip, l2tp_conf_path=DEFAULT_L2TP_CONF_PATH): conf = L2TPConfParser().parse_file(l2tp_conf_path) return is_ip_in_range(ip, conf.get('remote_ip', []))
def is_pptp_ip(ip, pptp_conf_path=DEFAULT_PPTP_CONF_PATH): conf = PPTPConfParser().parse_file(pptp_conf_path) return is_ip_in_range(ip, conf.get('remote_ip', []))