mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-22 23:59:41 +08:00
resolver: per service, defaultresolve, fakeresolve or sysresolve
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Waiting to run
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Waiting to run
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Waiting to run
Each service resolves names the way the last of defaultresolve (the name servers in force, configured or the system's with the hosts file), fakeresolve (127.0.0.2) and sysresolve (the C library) read before it says; the last one in the configuration also applies outside services. defaultresolve is the new command, and the default. The name servers and the hosts file no longer depend on the mode: nserver lines, or the system's, are always in force, so dnspr keeps forwarding; with fakeresolve it does not, as before. fakeresolver moves to common.c, which the standalone services link without resolve.c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
994526dbc4
commit
3d20e1104e
14 files changed
+181
-101
No files matched your search
+6
-6
@@ -268,18 +268,18 @@ void applyportranges(struct clientparam * param, struct ace * acentry){
|
||||
}
|
||||
}
|
||||
|
||||
static void chainaddr(struct chain * cur, PROXYSOCKADDRTYPE * sa){
|
||||
static void chainaddr(struct clientparam * param, struct chain * cur, PROXYSOCKADDRTYPE * sa){
|
||||
PROXYSOCKADDRTYPE fresh;
|
||||
|
||||
*sa = cur->addr;
|
||||
if(resolvfunc != myresolver) return;
|
||||
if(param->srv->resolvmode != RESOLVE_DEFAULT || resolvfunc != myresolver) return;
|
||||
if(!cur->exthost || SAISNULL(&cur->addr)) return;
|
||||
#ifdef WITH_UN
|
||||
if(*SAFAMILY(&cur->addr) == AF_UNIX) return;
|
||||
#endif
|
||||
if(afdetect(cur->exthost) != -1) return;
|
||||
memset(&fresh, 0, sizeof(fresh));
|
||||
if(!getip46(46, cur->exthost, (struct sockaddr *)&fresh)) return;
|
||||
if(!getip46m(RESOLVE_DEFAULT, 46, cur->exthost, (struct sockaddr *)&fresh)) return;
|
||||
*SAPORT(&fresh) = *SAPORT(&cur->addr);
|
||||
*sa = fresh;
|
||||
}
|
||||
@@ -430,12 +430,12 @@ int handleredirect(struct clientparam * param, struct ace * acentry){
|
||||
}
|
||||
else if(!*SAPORT(&cur->addr) && !SAISNULL(&cur->addr)) {
|
||||
uint16_t port = *SAPORT(¶m->sinsr);
|
||||
chainaddr(cur, ¶m->sinsr);
|
||||
chainaddr(param, cur, ¶m->sinsr);
|
||||
*SAPORT(¶m->sinsr) = port;
|
||||
}
|
||||
else if(SAISNULL(&cur->addr) && *SAPORT(&cur->addr)) *SAPORT(¶m->sinsr) = *SAPORT(&cur->addr);
|
||||
else {
|
||||
chainaddr(cur, ¶m->sinsr);
|
||||
chainaddr(param, cur, ¶m->sinsr);
|
||||
}
|
||||
if(param->operation == UDPASSOC){
|
||||
SOCKET s;
|
||||
@@ -468,7 +468,7 @@ int handleredirect(struct clientparam * param, struct ace * acentry){
|
||||
else {
|
||||
PROXYSOCKADDRTYPE next;
|
||||
|
||||
chainaddr(cur, &next);
|
||||
chainaddr(param, cur, &next);
|
||||
res = (redir)?clientnegotiate(redir, param, (struct sockaddr *)&next, cur->exthost):0;
|
||||
if(res) {
|
||||
parentfail(param, cur);
|
||||
|
||||
Reference in new issue
Block a user