Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文档中的域名通配的问题 #1717

Open
cokebar opened this issue Apr 8, 2024 · 1 comment
Open

文档中的域名通配的问题 #1717

cokebar opened this issue Apr 8, 2024 · 1 comment

Comments

@cokebar
Copy link

cokebar commented Apr 8, 2024

说明中,通配前缀是*-a.,是不是多了一个a
image
因为看了源码,看起来通配应该是*-.

smartdns/src/dns_conf.c

Lines 1436 to 1457 in 2234976

reverse_string(domain_key + 1, domain, len, 1);
if (domain[0] == '*' && domain_len > 1) {
/* prefix wildcard */
len--;
if (domain[1] == '.') {
tmp_sub_rule_only = 1;
} else if ((domain[1] == '-') && (domain[2] == '.')) {
len--;
tmp_sub_rule_only = 1;
tmp_root_rule_only = 1;
}
} else if (domain[0] == '-' && domain_len > 1) {
/* root match only */
len--;
if (domain[1] == '.') {
tmp_root_rule_only = 1;
}
} else if (len > 0) {
/* suffix match */
domain_key[len + 1] = '.';
len++;
}

@cokebar cokebar changed the title 文档中的域名通配的疑问 文档中的域名通配的问题 Apr 8, 2024
@ixmu
Copy link

ixmu commented Apr 25, 2024

从右到左匹配
例如
1、baidu.com,实际匹配baidu.com结尾的任何域名
2、*.baidu.com,实际匹配.baidu.com结尾的任何域名
3、-.baidu.com,实际匹配baidu.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants