Compare commits

..

1 Commits

Author SHA1 Message Date
ilya
f631d8888e
Merge e3e13af922 into 1276f5f176 2026-03-27 21:55:32 +00:00
12 changed files with 96 additions and 169 deletions

View File

@ -23,56 +23,34 @@ jobs:
- uses: actions/checkout@v4
# - name: configure
# run: ./configure
- name: ln Linux
if: ${{ startsWith(matrix.target, 'ubuntu') }}
run: ln -s Makefile.Linux Makefile
- name: Linux libraries
if: ${{ startsWith(matrix.target, 'ubuntu') }}
run: sudo apt install libssl-dev libpam-dev libpcre3 libpcre3-dev
- name: make Ubuntu
if: ${{ startsWith(matrix.target, 'ubuntu') }}
run: make -f Makefile.Linux
- name: Mac libraries
if: ${{ startsWith(matrix.target, 'macos') }}
run: brew install pcre
- name: ln Mac
if: ${{ startsWith(matrix.target, 'macos') }}
run: ln -s Makefile.FreeBSD Makefile
- name: Mac variables
if: ${{ startsWith(matrix.target, 'macos') }}
run: echo "LDFLAGS=-L/usr/local/lib -L/opt/homebrew/lib -L/usr/local/opt/openssl/lib -L/opt/homebrew/opt/openssl/lib" >> $GITHUB_ENV && echo "CFLAGS=-I/usr/local/include -I/opt/homebrew/include -I/usr/local/opt/openssl/include -I/opt/homebrew/opt/openssl/include" >> $GITHUB_ENV
- name: ln Windows
if: ${{ startsWith(matrix.target, 'windows') }}
run: copy Makefile.win Makefile
- name: dirs Windows
if: ${{ startsWith(matrix.target, 'windows') }}
run: cmd /C 'echo LIBS := -L "c:/program files/openssl/lib/VC/x64/MT" $(LIBS) >>Makefile.win && echo CFLAGS := -I "c:/program files/openssl/include" $(CFLAGS) >>Makefile.win && type Makefile.win && dir "c:/program files/openssl/lib" && set && dir "C:/mingw64/bin" && dir "C:/" && dir "C:/msys64/ucrt64/bin"'
- name: make
run: make
- name: mkdir
if: ${{ startsWith(matrix.target, 'ubuntu') }}
run: mkdir ~/3proxy
- name: make install
if: ${{ startsWith(matrix.target, 'ubuntu') }}
run: make -f Makefile.Linux DESTDIR=~/3proxy install
- name: make clean Linux
if: ${{ startsWith(matrix.target, 'ubuntu') }}
run: make -f Makefile.Linux clean
- name: Mac libraries
if: ${{ startsWith(matrix.target, 'macos') }}
run: brew install pcre
- name: make MacOS
if: ${{ startsWith(matrix.target, 'macos') }}
run: make -f Makefile.FreeBSD
env:
LDFLAGS: "-L/usr/local/lib -L/opt/homebrew/lib -L/opt/homebrew/opt/openssl/lib"
CFLAGS: "-I/usr/local/include -I/opt/homebrew/include -I/usr/local/opt/openssl/include -I/opt/homebrew/opt/openssl/include"
- name: make clean MacOS
if: ${{ startsWith(matrix.target, 'macos') }}
run: make -f Makefile.FreeBSD clean
- name: make Windows
if: ${{ startsWith(matrix.target, 'windows') }}
run: make -f Makefile.win
env:
LIBS: '-L "c:/program files/openssl/lib/VC/x64/MT"'
CFLAGS: '-I "c:/program files/openssl/include"'
- name: make clean Windows
if: ${{ startsWith(matrix.target, 'windows') }}
run: make -f Makefile.win clean
- name: Add msbuild to PATH
if: ${{ startsWith(matrix.target, 'windows') }}
uses: microsoft/setup-msbuild@v3
- name: make Windows MSVC
if: ${{ startsWith(matrix.target, 'windows') }}
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
D:
cd "D:/a/3proxy/3proxy"
mkdir bin64
set "LIB=%LIB%;c:/program files/openssl/lib/VC/x64/MT"
nmake /F Makefile.msvc64
nmake /F Makefile.msvc64 clean
env:
LIBS: '/LIBPATH:"c:/program files/openssl/lib/VC/x64/MT"'
CFLAGS: '-I "c:/program files/openssl/include"'
run: make DESTDIR=~/3proxy install
- name: make clean
run: make clean

1
.gitignore vendored
View File

@ -259,4 +259,3 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
CLAUDE.md

View File

@ -7,14 +7,14 @@
BUILDDIR = ../bin/
CC ?= cc
CFLAGS := -c -fno-strict-aliasing -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS)
CFLAGS += -c -fno-strict-aliasing -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o
LN ?= ${CC}
LDFLAGS += -pthread -fno-strict-aliasing
# -lpthreads may be reuiured on some platforms instead of -pthreads
# -ldl or -lld may be required for some platforms
DCFLAGS ?= -fPIC
DLFLAGS ?= -shared
DCFLAGS = -fPIC
DLFLAGS = -shared
DLSUFFICS = .so
LIBS ?=
LIBSPREFIX = -l

View File

@ -8,14 +8,14 @@
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
BUILDDIR = ../bin/
CC ?= gcc
CC = gcc
CFLAGS := -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER $(CFLAGS)
CFLAGS = -g -fPIC -O2 -fno-strict-aliasing -c -pthread -DWITHSPLICE -D_GNU_SOURCE -DGETHOSTBYNAME_R -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL -DWITH_NETFILTER
COUT = -o
LN ?= ${CC}
DCFLAGS ?=
LDFLAGS ?= -fPIC -O2 -fno-strict-aliasing -pthread
DLFLAGS ?= -shared
LN = $(CC)
DCFLAGS =
LDFLAGS = -fPIC -O2 -fno-strict-aliasing -pthread
DLFLAGS = -shared
DLSUFFICS = .ld.so
# -lpthreads may be reuqired on some platforms instead of -pthreads
LIBSPREFIX = -l

View File

@ -10,13 +10,13 @@ MAKEFILE = Makefile.msvc64
BUILDDIR = ../bin64/
CC = cl
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_SSL" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE) $(CFLAGS)
CFLAGS = /nologo /MT /W3 /Ox /EHs- /GS /GA /GF /D "MSVC" /D "WITH_STD_MALLOC" /D "WITH_SSL" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRINTF_INT64_MODIFIER=\"I64\"" /Fp"proxy.pch" /FD /c $(VERSION) $(BUILDDATE)
COUT = /Fo
LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no /machine:x64
DLFLAGS = /DLL
DLSUFFICS = .dll
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib Crypt32.lib libcrypto.lib libssl.lib $(LIBS)
LIBS = ws2_32.lib advapi32.lib odbc32.lib user32.lib kernel32.lib Gdi32.lib Crypt32.lib libcrypto.lib libssl.lib
LIBSOLD = libeay32.lib ssleay32.lib
LIBSPREFIX =
LIBSSUFFIX = .lib
@ -31,7 +31,7 @@ TYPECOMMAND = type
COMPATLIBS =
VERFILE = 3proxy.res $(VERFILE)
VERSIONDEP = 3proxy.res $(VERSIONDEP)
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin SSLPlugin
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin SSLPlugin PCREPlugin
AFTERCLEAN = del src\*.res
include Makefile.inc

View File

@ -8,21 +8,21 @@
# library support. Add -DSAFESQL for poorely written ODBC library / drivers.
BUILDDIR = ../bin/
CC ?= gcc
CC = gcc
# you may need -L/usr/pkg/lib for older NetBSD versions
CFLAGS := -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL $(CFLAGS)
CFLAGS = -g -O2 -fno-strict-aliasing -c -pthread -D_THREAD_SAFE -D_REENTRANT -DNOODBC -DWITH_STD_MALLOC -DFD_SETSIZE=4096 -DWITH_POLL
COUT = -o
LN ?= $(CC)
LDFLAGS ?= -O2 -fno-strict-aliasing -pthread
LN = $(CC)
LDFLAGS = -O2 -fno-strict-aliasing -pthread
# -lpthreads may be reuqired on some platforms instead of -pthreads
# -ldl or -lld may be required for some platforms
DCFLAGS ?= -fPIC
DLFLAGS ?= -shared
DLSUFFICS ?= .ld.so
DCFLAGS = -fPIC
DLFLAGS = -shared
DLSUFFICS = .ld.so
LIBS ?=
LIBSPREFIX ?= -l
LIBSSUFFIX ?=
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o
EXESUFFICS =
OBJSUFFICS = .o

View File

@ -9,14 +9,14 @@
BUILDDIR = ../bin/
CC ?= gcc
CFLAGS := -O2 -s -c -mthreads -DWITH_STD_MALLOC -DWITH_WSAPOLL $(CFLAGS)
CC = gcc
CFLAGS = -O2 -s -c -mthreads -DWITH_STD_MALLOC -DWITH_WSAPOLL
COUT = -o
LN ?= $(CC)
LDFLAGS ?= -O2 -s -mthreads
DLFLAGS ?= -shared
LN = gcc
LDFLAGS = -O2 -s -mthreads
DLFLAGS = -shared
DLSUFFICS = .dll
LIBS := -lws2_32 -lodbc32 -ladvapi32 -luser32 $(LIBS)
LIBS = -lws2_32 -lodbc32 -ladvapi32 -luser32 -lcrypto -lssl
LIBSPREFIX = -l
LIBSSUFFIX =
LNOUT = -o
@ -28,28 +28,13 @@ REMOVECOMMAND = rm -f
TYPECOMMAND = cat
COMPATLIBS =
MAKEFILE = Makefile.win
PLUGINS := utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin SSLPLugin PCREPlugin
VERFILE := 3proxyres.o $(VERFILE)
VERSION := $(VERSION)
VERSIONDEP := 3proxyres.o $(VERSIONDEP)
BUILDDATE := $(BUILDDATE)
AFTERCLEAN = (find . -type f -name "*.o" -delete && find . -type f -name "*.res" -delete && find src/ -type f -name "Makefile.var" -delete && find bin/ -type f -executable -delete) || true
OPENSSL_CHECK = $(shell echo "#include <openssl/ssl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l crypto -l ssl -o testssl - 2>/dev/null && rm testssl && echo true||echo false)
ifeq ($(OPENSSL_CHECK), true)
LIBS += -l crypto -l ssl
PLUGINS += SSLPlugin
endif
PCRE_CHECK = $(shell echo "#include <pcre.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pcre -o testpcre - 2>/dev/null && rm testpcre && echo true||echo false)
ifeq ($(PCRE_CHECK), true)
PLUGINS += PCREPlugin
endif
PAM_CHECK = $(shell echo "#include <security/pam_appl.h>\\n int main(){return 0;}" | cc -x c $(CFLAGS) $(LDFLAGS) -l pam -o testpam - 2>/dev/null && rm testpam && echo true||echo false)
ifeq ($(PAM_CHECK), true)
PLUGINS += PamAuth
endif
include Makefile.inc
3proxyres.o:

View File

@ -13,6 +13,9 @@
#include <dlfcn.h>
#endif
#else
#ifdef WITH_SSL
#include <openssl/applink.c>
#endif
#endif

View File

@ -92,85 +92,49 @@ char *rotations[] = {
};
int timeouts[12] = {
1, /* SINGLEBYTE_S */
5, /* SINGLEBYTE_L */
30, /* STRING_S */
60, /* STRING_L */
180, /* CONNECTION_S */
1800, /* CONNECTION_L */
15, /* DNS_TO */
60, /* CHAIN_TO */
15, /* CONNECT_TO */
5, /* CONNBACK_TO */
0,
0
};
struct extparam conf = {
.threadinit = {0, 0},
.timeouts = timeouts,
.acl = NULL,
.conffile = NULL,
.bandlimiter = NULL,
.bandlimiterout = NULL,
.connlimiter = NULL,
.trafcounter = NULL,
.services = NULL,
.stacksize = 0,
.counterd = -1,
.haveerror = 0,
.rotate = 0,
.paused = 0,
.archiverc = 0,
.demon = 0,
.maxchild = 500,
.backlog = 0,
.needreload = 0,
.timetoexit = 0,
.version = 0,
.noforce = 0,
.bandlimver = 0,
.parentretries = 2,
.authcachetype = 6,
.authcachetime = 600,
.filtermaxsize = 1048576,
.gracetraf = 0,
.gracenum = 0,
.gracedelay = 0,
.maxseg = 0,
.logname = NULL,
.archiver = NULL,
.logtype = NONE,
.countertype = NONE,
.counterfile = NULL,
{0, 0}, /* threadinit */
{1, 5, 30, 60, 180, 1800, 15, 60, 15, 5, 0, 0}, /* timeouts */
NULL, /* struct ace * acl; */
NULL, /* char * conffile; */
NULL, NULL, /* struct bandlim * bandlimiter, *bandlimiterout; */
NULL, /* struct connlim * connlimiter; */
NULL, /* struct trafcount * trafcounter; */
NULL, /* struct srvparam *services; */
0, /* int stacksize, */
-1, 0, 0, 0, 0, /* counterd, haveerror, rotate, paused, archiverc, */
0, 500, 0, 0, 0, 0, 0, 0, 2, /* demon, maxchild, backlog, needreload, timetoexit, version, noforce, bandlimver, parentretries; */
6, 600, /* int authcachetype, authcachetime; */
1048576, /* int filtermaxsize; */
0, 0, 0, /* int gracetraf, gracenum, gracedelay */
0, /* int maxseg */
NULL, NULL, /* unsigned char *logname, **archiver; */
NONE, NONE, /* ROTATION logtype, countertype; */
NULL, /* char * counterfile; */
#ifndef NOIPV6
.intsa = {AF_INET},
.extsa6 = {AF_INET6},
.extsa = {AF_INET},
{AF_INET},
{AF_INET6},
{AF_INET},
#else
.intsa = {AF_INET},
.extsa = {AF_INET},
{AF_INET},
{AF_INET},
#endif
.pwl = NULL,
.authenticate = NULL,
.authfunc = doconnect,
.logfunc = lognone,
.bandlimfunc = NULL,
.trafcountfunc = NULL,
.logtarget = NULL,
.logformat = NULL,
.fmon = NULL,
.filters = NULL,
.authfuncs = NULL,
.stdlog = NULL,
.demanddialprog = NULL,
.stringtable = NULL,
.logtime = (time_t)0,
.time = (time_t)0,
.logdumpsrv = 0,
.logdumpcli = 0,
.delimchar = '@',
NULL,
NULL,
doconnect,
lognone,
NULL,
NULL,
NULL, NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
(time_t)0, (time_t)0,
0,0,
'@',
};
int numservers=0;

View File

@ -200,12 +200,12 @@ void mylogfunc(struct clientparam * param, const unsigned char * pz) {
#endif
rule++;
if (((g_s == param->service) && (port == myhtons(*SAPORT(&param->sinsr)))) ||
( ((starttrafcorrect->con_type == UDP) &&
( ((starttrafcorrect->type == UDP) &&
((param->operation == UDPASSOC)||
(param->operation == DNSRESOLVE)||
(param->operation == BIND)||
(param->operation == ICMPASSOC))
)||(starttrafcorrect->con_type == TCP))) /* TCP support */
)||(starttrafcorrect->type == TCP))) /* TCP support */
{
/* ôèëüòð ïîäîø¸ë. ìîæíî èçìåíÿòü çíà÷åíèå òðàôôèêà
äîìíîæàåì íà ÷èñëî */

View File

@ -154,8 +154,6 @@ extern int timetoexit;
extern struct extparam conf;
extern int timeouts[12];
int sockmap(struct clientparam * param, int timeo, int usesplice);
int socksend(struct clientparam *param, SOCKET sock, unsigned char * buf, int bufsize, int to);
int socksendto(struct clientparam *param, SOCKET sock, struct sockaddr * sin, unsigned char * buf, int bufsize, int to);

View File

@ -643,7 +643,7 @@ struct extparam {
#else
int threadinit[2];
#endif
int *timeouts;
int timeouts[12];
struct ace * acl;
char * conffile;
struct bandlim * bandlimiter, *bandlimiterout;