mirror of
https://github.com/3proxy/3proxy.git
synced 2026-06-20 07:28:55 +00:00
Use unix:/path/to/socket, e.g. tcppm 1234 unix:/path/to/socket 1234 Under linux abstract sockets are supported with '@' prefix, e.g. parent 1000 http unix:@virtual.3proxy.socket 1111 Destination port numbers are not used in tcppm/parent, but you must specify any positive value to match the syntaxis.
63 lines
1.3 KiB
C
63 lines
1.3 KiB
C
/*
|
|
3APA3A simplest proxy server
|
|
(c) 2002-2021 by Vladimir Dubrovin <3proxy@3proxy.org>
|
|
|
|
please read License Agreement
|
|
|
|
*/
|
|
|
|
#include "proxy.h"
|
|
|
|
#ifndef PORTMAP
|
|
#define PORTMAP
|
|
#endif
|
|
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }
|
|
|
|
void * tcppmchild(struct clientparam* param) {
|
|
int res;
|
|
|
|
if(!param->hostname){
|
|
#ifdef WITH_UN
|
|
if(!strncmp((char *)param->srv->target, "unix:", 5)){
|
|
make_un(param->srv->target + 5, (struct sockaddr_un *)¶m->sinsr);
|
|
make_un(param->srv->target + 5, (struct sockaddr_un *)¶m->req);
|
|
param->hostname = (unsigned char *)mystrdup((char *)param->srv->target);
|
|
} else
|
|
#endif
|
|
if(
|
|
parsehostname((char *)param->srv->target, param, ntohs(param->srv->targetport))
|
|
) RETURN(100);
|
|
}
|
|
param->operation = CONNECT;
|
|
res = (*param->srv->authfunc)(param);
|
|
if(res) {RETURN(res);}
|
|
if (param->npredatfilters){
|
|
int action;
|
|
action = handlepredatflt(param);
|
|
if(action == HANDLED){
|
|
RETURN(0);
|
|
}
|
|
if(action != PASS) RETURN(19);
|
|
}
|
|
if(param->redirectfunc){
|
|
return (*param->redirectfunc)(param);
|
|
}
|
|
|
|
RETURN (mapsocket(param, conf.timeouts[CONNECTION_L]));
|
|
CLEANRET:
|
|
|
|
dolog(param, param->hostname);
|
|
freeparam(param);
|
|
return (NULL);
|
|
}
|
|
|
|
#ifdef WITHMAIN
|
|
struct proxydef childdef = {
|
|
tcppmchild,
|
|
0,
|
|
0,
|
|
S_TCPPM,
|
|
""
|
|
};
|
|
#include "proxymain.c"
|
|
#endif
|