Example #1
0
def stub_rules_check(data):
    if len(data) == 5 and view_exist(data['view']) and is_domain(
            data['domain']) and data['ttl'] > 0 and (len(
                data['ns']) == 0 or is_domain(data['ns'])) and (len(
                    data['ip']) == 0 or is_ip(data['ip'])):
        return True
    return False
Example #2
0
def rrset_rules_check(data):
    if len(data) == 6 and view_exist(data['view']) and is_domain(
            data['domain']) and is_qtype(
                data['qtype']
            ) and data['ttl'] > 0 and data['weight'] > 0 and is_dns_answer(
                data['qtype'], data['answer']):
        return True
    return False
Example #3
0
def dns64_rules_check(data):
    if len(data) == 3 and view_exist(data['view']) and is_domain(
            data['domain']) and is_ip(data['ipv6prefix']):
        return True
    return False
Example #4
0
def forward_rules_check(data):
    if len(data) == 5 and view_exist(data['view']) and is_domain(data['domain']) and len(data['servergroup']) > 0 and (data['type'] == 'first' or data['type'] == 'only')\
    and (data['action'] == 'merge' or data['action'] == 'normal'):
        return True
    return False
Example #5
0
def forward_server_check(data):
    if len(data) == 4 and view_exist(
            data['view']) and len(data['servergroup']) > 0 and is_ip(
                data['ip']) and data['weight'] < 16 and data['weight'] > 0:
        return True
    return False
Example #6
0
def view_domain_qtype_check(data):
    if len(data) == 3 and view_exist(data['view']) and is_domain(
            data['domain']) and is_qtype(data['qtype']):
        return True
    return False
Example #7
0
def file_view_check(data):
    if len(data) == 2 and view_exist(data['view']) and len(data['file']) > 0:
        return True
    return False
Example #8
0
def view_ip_domain_check(data):
    if len(data) == 3 and view_exist(data['view']) and is_domain(
            data['domain']) and is_ip(data['ip']):
        return True
    return False
Example #9
0
def rrfilter_rules_check(data):
    if len(data) == 4 and view_exist(data['view']) and is_domain(
            data['domain']) and is_qtype(data['qtype']) and is_answer(
                data['qtype'], data['answer']):
        return True
    return False
Example #10
0
def view_ip_check(data):
    if len(data) == 2 and view_exist(data['view']) and is_ip(data['ip']):
        return True
    return False
Example #11
0
def ttl_rules_check(data):
    if len(data) == 4 and view_exist(data['view']) and is_domain(
            data['domain']) and data['minttl'] > 0 and data[
                'maxttl'] > 0 and data['maxttl'] > data['minttl']:
        return True
    return False
Example #12
0
def cache_qtype_check(data):
    if len(data) == 2 and view_exist(data['view']) and is_qtype(data['qtype']):
        return True
    return False
Example #13
0
def sortlist_rules_check(data):
    # 需要判断sortlist数据
    if len(data) == 3 and view_exist(data['view']) and is_domain(
            data['domain']) and len(data['sortlist']) > 0:
        return True
    return False
Example #14
0
def view_redirect_ip_check(data):
    if len(data) == 3 and view_exist(data['view']) and is_ip(
            data['ip']) and data['weight'] < 16 and data['weight'] > 0:
        return True
    return False
Example #15
0
def view_switch_check(data):
    if len(data) == 2 and view_exist(
            data['view']) and (data['switch'] == 'enable'
                               or data['switch'] == 'disable'):
        return True
    return False