Compare commits

...

5 Commits

Author SHA1 Message Date
jendis
00785d0f4a
Merge 983df6f7ae into 0c8be907e9 2026-04-11 00:28:12 +08:00
Vladimir Dubrovin
0c8be907e9 -Ne / -Ni options added to specify external / internal NAT address
Some checks are pending
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
2026-04-10 15:01:43 +03:00
Vladimir Dubrovin
840dd5dbdf Update Makefile.Linux 2026-04-10 13:14:00 +03:00
Vladimir Dubrovin
71d676eb58 Update workflows and builds
Some checks failed
RPM/DEB build aarch64 / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
RPM/DEB build armhf / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
RPM/DEB build x86-64 / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
Build Win32 3proxy-lite with Watcom / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
Build Win32 3proxy with MSVC / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
Build Win64 3proxy with MSVC / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
Build Win-arm64 3proxy with MSVC / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
2026-04-09 17:53:27 +03:00
Jan Smutny
983df6f7ae Extend SOCKS for AnyIP utilization
Introduce '-k' parameter that overwrites the -e parameter (if given) and
uses the IP for the external connection that corresponds to the current client
connection. The benefit arises when the parameter '-i0.0.0.0' or '-i::' in case
of IPv6 is set. This allows the entire range configured as local on the system
to receive connections and establish connections to the target server using the
IP address to which the client connected.
Note: This feature is not applicable for Windows.
2025-02-06 13:23:03 +01:00
28 changed files with 280 additions and 203 deletions

View File

@ -1,8 +1,8 @@
name: RPM build arm name: RPM/DEB build aarch64
on: on:
push: push:
branches: [ "master" ] branches: [ "master", "test-ci" ]
paths: [ 'RELEASE', '.github/workflows/build-rpm-arm64.yml' ] paths: [ 'RELEASE', '.github/workflows/build-rpm-arm64.yml' ]
jobs: jobs:
@ -11,10 +11,10 @@ jobs:
strategy: strategy:
matrix: matrix:
target: target:
- ubuntu-latest - ubuntu-24.04-arm
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: env - name: env
run: | run: |
pwd pwd
@ -23,49 +23,49 @@ jobs:
echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV echo "MAJOR=$(cat RELEASE | cut -d "-" -f 1)" >> $GITHUB_ENV
echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV echo "SUBMAJOR=$(cat RELEASE | cut -d "-" -f 2)" >> $GITHUB_ENV
echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV echo "MINOR=$(cat RELEASE | cut -d "-" -f 3)" >> $GITHUB_ENV
- name: echo env
run: echo "release $RELEASE version $VERSION major $MAJOR submajor $SUBMAJOR minor $MINOR"
- name: Linux libraries - name: Linux libraries
run: | run: |
sudo apt update sudo apt update
sudo dpkg --add-architecture arm64 sudo apt install libssl-dev libpam-dev libpcre2-dev rpm build-essential debhelper
echo "Types: deb" > ~/ubuntu.sources
echo "URIs: http://archive.ubuntu.com/ubuntu/" >> ~/ubuntu.sources
echo "Suites: noble noble-updates noble-backports" >> ~/ubuntu.sources
echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources
echo "Architectures: amd64" >> ~/ubuntu.sources
echo "" >> ~/ubuntu.sources
echo "Types: deb" >> ~/ubuntu.sources
echo "URIs: http://security.ubuntu.com/ubuntu/" >> ~/ubuntu.sources
echo "Suites: noble-security" >> ~/ubuntu.sources
echo "Components: main restricted universe multiverse" >> ~/ubuntu.sources
echo "Architectures: amd64" >> ~/ubuntu.sources
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >> ~/ubuntu.sources
echo "" >> ~/ubuntu.sources
echo "Types: deb" >>~/ubuntu.sources
echo "URIs: http://ports.ubuntu.com/ubuntu-ports/" >>~/ubuntu.sources
echo "Suites: noble noble-updates" >>~/ubuntu.sources
echo "Components: main restricted universe multiverse" >>~/ubuntu.sources
echo "Architectures: arm64" >>~/ubuntu.sources
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >>~/ubuntu.sources
sudo cp ~/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources
sudo apt update
sudo apt install libssl-dev:arm64 libpam0g:arm64 libpam0g-dev:arm64 libpcre2-dev:arm64 rpm crossbuild-essential-arm64
- name: make rpmbuild dir
run: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- name: configure rpm env - name: configure rpm env
run: | run: |
mkdir ~/debian
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," .
ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
- name: rpmbuild - name: rpmbuild
run: | run: |
ret=`pwd` ret=`pwd`
cd ~/rpmbuild/SPECS cd ~/rpmbuild/SPECS
rpmbuild -ba --define "PAMLIB pam0g" --define "_arch aarch64" --define "cross yes" --target=aarch64-linux-gnueabi 3proxy-$RELEASE.spec rpmbuild -ba 3proxy-$RELEASE.spec
cd $ret cd $ret
mv ~/rpmbuild/RPMS/aarch64/3proxy-$RELEASE-1.aarch64.rpm 3proxy-$RELEASE.arm64.rpm mv ~/rpmbuild/RPMS/aarch64/3proxy-$RELEASE-1.aarch64.rpm 3proxy-$RELEASE.arm64.rpm
- name: Get artifact - name: Get artifact arp
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: "3proxy-${{ env.RELEASE }}-arm64.rpm" name: "3proxy-${{ env.RELEASE }}-arm64.rpm"
path: "*.rpm" path: "*.rpm"
- name: debbuild
run: |
ret=`pwd`
cd ~/debian/
tar xzf 3proxy_$RELEASE.orig.tar.gz
cd 3proxy-$RELEASE
echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium" >debian/changelog
echo " " >>debian/changelog
echo " *3proxy $RELEASE build" >>debian/changelog
echo " " >>debian/changelog
echo " -- z3APA3A <3apa3a@3proxy.org> "`date "+%a, %d %b %Y %H:%M:%S %z"` >>debian/changelog
echo "">>debian/changelog
dpkg-buildpackage
cd $ret
cp ~/debian/3proxy_$RELEASE-"$VERSION"_arm64.deb ./3proxy-$RELEASE.arm64.deb
- name: Get artifact deb
uses: actions/upload-artifact@v6
with:
name: "3proxy-${{ env.RELEASE }}-arm64.deb"
path: "*.deb"

View File

@ -1,8 +1,8 @@
name: RPM build arm name: RPM/DEB build armhf
on: on:
push: push:
branches: [ "master" ] branches: [ "master", "test-ci" ]
paths: [ 'RELEASE', '.github/workflows/build-rpm-armhf.yml' ] paths: [ 'RELEASE', '.github/workflows/build-rpm-armhf.yml' ]
jobs: jobs:
@ -14,7 +14,7 @@ jobs:
- ubuntu-latest - ubuntu-latest
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: env - name: env
run: | run: |
pwd pwd
@ -49,24 +49,56 @@ jobs:
echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >>~/ubuntu.sources echo "Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" >>~/ubuntu.sources
sudo cp ~/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources sudo cp ~/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources
sudo apt update sudo apt update
sudo apt install libssl-dev:armhf libpam0g:armhf libpam0g-dev:armhf libpcre2-dev:armhf rpm crossbuild-essential-armhf sudo apt install libssl3t64:armhf openssl:armhf libssl-dev:armhf libpam0g:armhf libpam0g-dev:armhf libpcre2-dev:armhf rpm crossbuild-essential-armhf build-essential debhelper
- name: make rpmbuild dir
run: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- name: configure rpm env - name: configure rpm env
run: | run: |
mkdir ~/debian
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," .
ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
- name: rpmbuild - name: rpmbuild
run: | run: |
ret=`pwd` ret=`pwd`
cd ~/rpmbuild/SPECS cd ~/rpmbuild/SPECS
PATH=/usr/arm-linux-gnueabihf/bin:$PATH
export PATH=$PATH
CC=arm-linux-gnueabihf-gcc
export CC=$CC
export RPATH=/usr/arm-linux-gnueabihf/lib:$RPATH
export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib:$LD_LIBRARY_PATH
rpmbuild -ba --define "PAMLIB pam0g" --define "_arch arm" --define "cross yes" --target=arm-linux-gnueabi 3proxy-$RELEASE.spec rpmbuild -ba --define "PAMLIB pam0g" --define "_arch arm" --define "cross yes" --target=arm-linux-gnueabi 3proxy-$RELEASE.spec
cd $ret cd $ret
mv ~/rpmbuild/RPMS/arm/3proxy-$RELEASE-1.arm.rpm 3proxy-$RELEASE.arm.rpm mv ~/rpmbuild/RPMS/arm/3proxy-$RELEASE-1.arm.rpm 3proxy-$RELEASE.arm.rpm
- name: Get artifact - name: Get artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: "3proxy-${{ env.RELEASE }}-arm.rpm" name: "3proxy-${{ env.RELEASE }}-arm.rpm"
path: "*.rpm" path: "*.rpm"
- name: debbuild
run: |
ret=`pwd`
cd ~/debian/
tar xzf 3proxy_$RELEASE.orig.tar.gz
cd 3proxy-$RELEASE
echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium" >debian/changelog
echo " " >>debian/changelog
echo " *3proxy $RELEASE build" >>debian/changelog
echo " " >>debian/changelog
echo " -- z3APA3A <3apa3a@3proxy.org> "`date "+%a, %d %b %Y %H:%M:%S %z"` >>debian/changelog
echo "">>debian/changelog
PATH=/usr/arm-linux-gnueabihf/bin:$PATH
export PATH=$PATH
CC=arm-linux-gnueabihf-gcc
export CC=$CC
export RPATH=/usr/arm-linux-gnueabihf/lib:$RPATH
export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib:$LD_LIBRARY_PATH
dpkg-buildpackage
cd $ret
cp ~/debian/3proxy_$RELEASE-"$VERSION"_armhf.deb ./3proxy-$RELEASE.arm.deb
- name: Get artifact deb
uses: actions/upload-artifact@v6
with:
name: "3proxy-${{ env.RELEASE }}-arm.deb"
path: "*.deb"

View File

@ -1,8 +1,8 @@
name: RPM build x86-64 name: RPM/DEB build x86-64
on: on:
push: push:
branches: [ "master" ] branches: [ "master", "test-ci" ]
paths: [ 'RELEASE', '.github/workflows/build-rpm-x86-64.yml' ] paths: [ 'RELEASE', '.github/workflows/build-rpm-x86-64.yml' ]
jobs: jobs:
@ -14,7 +14,7 @@ jobs:
- ubuntu-latest - ubuntu-latest
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: env - name: env
run: | run: |
pwd pwd
@ -28,14 +28,15 @@ jobs:
- name: Linux libraries - name: Linux libraries
run: | run: |
sudo apt update sudo apt update
sudo apt install libssl-dev libpam-dev libpcre2-dev rpm sudo apt install libssl-dev libpam-dev libpcre2-dev rpm build-essential debhelper
- name: make rpmbuild dir - name: configure rpm/deb env
run: mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
- name: configure rpm env
run: | run: |
mkdir ~/debian
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," . tar -czf ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz --transform "s,^,3proxy-$RELEASE/," .
ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz ln -s ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/rpmbuild/SOURCES/$RELEASE.tar.gz
cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec cp scripts/rh/3proxy.spec ~/rpmbuild/SPECS/3proxy-$RELEASE.spec
cp ~/rpmbuild/SOURCES/3proxy-$RELEASE.tar.gz ~/debian/3proxy_$RELEASE.orig.tar.gz
- name: rpmbuild - name: rpmbuild
run: | run: |
ret=`pwd` ret=`pwd`
@ -43,9 +44,29 @@ jobs:
rpmbuild -ba 3proxy-$RELEASE.spec rpmbuild -ba 3proxy-$RELEASE.spec
cd $ret cd $ret
mv ~/rpmbuild/RPMS/x86_64/3proxy-$RELEASE-1.x86_64.rpm 3proxy-$RELEASE.x86_64.rpm mv ~/rpmbuild/RPMS/x86_64/3proxy-$RELEASE-1.x86_64.rpm 3proxy-$RELEASE.x86_64.rpm
- name: Get artifact - name: Get artifact rpm
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: "3proxy-${{ env.RELEASE }}-x86_64.rpm" name: "3proxy-${{ env.RELEASE }}-x86_64.rpm"
path: "*.rpm" path: "*.rpm"
- name: debbuild
run: |
ret=`pwd`
cd ~/debian/
tar xzf 3proxy_$RELEASE.orig.tar.gz
cd 3proxy-$RELEASE
echo "3proxy ($RELEASE-$VERSION) buster; urgency=medium" >debian/changelog
echo " " >>debian/changelog
echo " *3proxy $RELEASE build" >>debian/changelog
echo " " >>debian/changelog
echo " -- z3APA3A <3apa3a@3proxy.org> "`date "+%a, %d %b %Y %H:%M:%S %z"` >>debian/changelog
echo "">>debian/changelog
dpkg-buildpackage
cd $ret
cp ~/debian/3proxy_$RELEASE-"$VERSION"_amd64.deb ./3proxy-$RELEASE.x86_64.deb
- name: Get artifact deb
uses: actions/upload-artifact@v6
with:
name: "3proxy-${{ env.RELEASE }}-x86_64.deb"
path: "*.deb"

View File

@ -14,7 +14,7 @@ jobs:
- windows-2022 - windows-2022
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# - name: configure # - name: configure
# run: ./configure # run: ./configure
- name: Setup Open Watcom - name: Setup Open Watcom
@ -25,14 +25,13 @@ jobs:
echo "now: $NOW" echo "now: $NOW"
$RELEASE = Get-Content -Path "RELEASE" -Raw $RELEASE = Get-Content -Path "RELEASE" -Raw
echo "release: $RELEASE" echo "release: $RELEASE"
echo "NOW=$NOW" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VERSION=VERSION=`"$RELEASE`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "BUILDDATE=BUILDDATE=`"$NOW`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: make Watcom - name: make Watcom
shell: cmd shell: cmd
run: | run: |
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
nmake /F Makefile.watcom nmake /F Makefile.watcom
- name: make dist dir - name: make dist dir
shell: cmd shell: cmd
@ -65,7 +64,7 @@ jobs:
copy README dist\3proxy\ copy README dist\3proxy\
copy rus.3ps dist\3proxy\ copy rus.3ps dist\3proxy\
- name: Get artifact - name: Get artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: "3proxy-${{ env.RELEASE }}-lite" name: "3proxy-${{ env.RELEASE }}-lite"
path: dist/ path: dist/

View File

@ -14,19 +14,16 @@ jobs:
- windows-2022 - windows-2022
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# - name: configure # - name: configure
# run: ./configure # run: ./configure
- name: set date - name: set date
run: | run: |
$NOW = Get-Date -Format "yyMMddHHmmss" $NOW = Get-Date -Format "yyMMddHHmmss"
echo "now: $NOW"
$RELEASE = Get-Content -Path "RELEASE" -Raw $RELEASE = Get-Content -Path "RELEASE" -Raw
echo "release: $RELEASE"
echo "NOW=$NOW" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VERSION=VERSION=`"$RELEASE`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "BUILDDATE=BUILDDATE=`"$NOW`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: install packages - name: install packages
run: vcpkg install pcre2:x86-windows-static openssl:x86-windows-static run: vcpkg install pcre2:x86-windows-static openssl:x86-windows-static
- name: Add msbuild to PATH - name: Add msbuild to PATH
@ -40,7 +37,7 @@ jobs:
cd "D:/a/3proxy/3proxy" cd "D:/a/3proxy/3proxy"
set "LIB=%LIB%;c:/vcpkg/installed/x86-windows-static/lib" set "LIB=%LIB%;c:/vcpkg/installed/x86-windows-static/lib"
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x86-windows-static/include" set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x86-windows-static/include"
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
nmake /F Makefile.msvc nmake /F Makefile.msvc
- name: make dist dir - name: make dist dir
shell: cmd shell: cmd
@ -73,7 +70,7 @@ jobs:
copy README dist\3proxy\ copy README dist\3proxy\
copy rus.3ps dist\3proxy\ copy rus.3ps dist\3proxy\
- name: Get artifact - name: Get artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: "3proxy-${{ env.RELEASE }}" name: "3proxy-${{ env.RELEASE }}"
path: dist/ path: dist/

View File

@ -14,19 +14,17 @@ jobs:
- windows-2022 - windows-2022
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# - name: configure # - name: configure
# run: ./configure # run: ./configure
- name: set date - name: set date
run: | run: |
$NOW = Get-Date -Format "yyMMddHHmmss" $NOW = Get-Date -Format "yyMMddHHmmss"
echo "now: $NOW"
$RELEASE = Get-Content -Path "RELEASE" -Raw $RELEASE = Get-Content -Path "RELEASE" -Raw
echo "release: $RELEASE"
echo "NOW=$NOW" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "NOW=$NOW" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VERSION=VERSION=`"$RELEASE`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "BUILDDATE=BUILDDATE=`"$NOW`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: install packages - name: install packages
run: vcpkg install pcre2:x64-windows-static openssl:x64-windows-static run: vcpkg install pcre2:x64-windows-static openssl:x64-windows-static
- name: Add msbuild to PATH - name: Add msbuild to PATH
@ -40,7 +38,8 @@ jobs:
cd "D:/a/3proxy/3proxy" cd "D:/a/3proxy/3proxy"
set "LIB=%LIB%;c:/vcpkg/installed/x64-windows-static/lib" set "LIB=%LIB%;c:/vcpkg/installed/x64-windows-static/lib"
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x64-windows-static/include" set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/x64-windows-static/include"
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
echo %NOW% / %RELEASE% / %BUILDDATE% / %VERSION%
nmake /F Makefile.msvc nmake /F Makefile.msvc
- name: make dist dir - name: make dist dir
shell: cmd shell: cmd
@ -73,7 +72,7 @@ jobs:
copy README dist\3proxy\ copy README dist\3proxy\
copy rus.3ps dist\3proxy\ copy rus.3ps dist\3proxy\
- name: Get artifact - name: Get artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: "3proxy-${{ env.RELEASE }}-x64" name: "3proxy-${{ env.RELEASE }}-x64"
path: dist/ path: dist/

View File

@ -14,19 +14,16 @@ jobs:
- windows-2022 - windows-2022
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# - name: configure # - name: configure
# run: ./configure # run: ./configure
- name: set date - name: set date
run: | run: |
$NOW = Get-Date -Format "yyMMddHHmmss" $NOW = Get-Date -Format "yyMMddHHmmss"
echo "now: $NOW"
$RELEASE = Get-Content -Path "RELEASE" -Raw $RELEASE = Get-Content -Path "RELEASE" -Raw
echo "release: $RELEASE"
echo "NOW=$NOW" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "RELEASE=$RELEASE" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "VERSION=VERSION=`"$RELEASE`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "VERSION=/D `"VERSION=\`"3proxy-$RELEASE\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "BUILDDATE=BUILDDATE=`"$NOW`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "BUILDDATE=/D `"BUILDDATE=\`"$NOW\`"`"" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: install packages - name: install packages
run: vcpkg install pcre2:arm64-windows-static openssl:arm64-windows-static run: vcpkg install pcre2:arm64-windows-static openssl:arm64-windows-static
- name: Add msbuild to PATH - name: Add msbuild to PATH
@ -40,7 +37,7 @@ jobs:
cd "D:/a/3proxy/3proxy" cd "D:/a/3proxy/3proxy"
set "LIB=%LIB%;c:/vcpkg/installed/arm64-windows-static/lib" set "LIB=%LIB%;c:/vcpkg/installed/arm64-windows-static/lib"
set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/arm64-windows-static/include" set "INCLUDE=%INCLUDE%;c:/vcpkg/installed/arm64-windows-static/include"
echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c echo "volatile char VerSion[]=^"3APA3A-3proxy-Internal-Build: 3proxy-%RELEASE%-%NOW%\r\nCode certificate: https://3proxy.org/3proxy.cer\r\n^";" >>src/3proxy.c
nmake /F Makefile.msvc nmake /F Makefile.msvc
- name: make dist dir - name: make dist dir
shell: cmd shell: cmd
@ -73,7 +70,7 @@ jobs:
copy README dist\3proxy\ copy README dist\3proxy\
copy rus.3ps dist\3proxy\ copy rus.3ps dist\3proxy\
- name: Get artifact - name: Get artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v6
with: with:
name: "3proxy-${{ env.RELEASE }}-arm64" name: "3proxy-${{ env.RELEASE }}-arm64"
path: dist/ path: dist/

View File

@ -18,7 +18,7 @@ jobs:
- ubuntu-24.04-arm - ubuntu-24.04-arm
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# - name: configure # - name: configure
# run: ./configure # run: ./configure
- name: Linux libraries - name: Linux libraries

View File

@ -17,7 +17,7 @@ jobs:
- macos-15 - macos-15
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# - name: configure # - name: configure
# run: ./configure # run: ./configure
- name: Mac libraries - name: Mac libraries

View File

@ -17,7 +17,7 @@ jobs:
- windows-2022 - windows-2022
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: install Windows libraries - name: install Windows libraries
run: vcpkg install pcre2:x64-windows && c:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-pcre2 mingw-w64-x86_64-openssl run: vcpkg install pcre2:x64-windows && c:\msys64\usr\bin\pacman.exe -S --noconfirm mingw-w64-x86_64-pcre2 mingw-w64-x86_64-openssl
- name: make Windows - name: make Windows

View File

@ -20,7 +20,7 @@ jobs:
- windows-2022 - windows-2022
runs-on: ${{ matrix.target }} runs-on: ${{ matrix.target }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
# - name: configure # - name: configure
# run: ./configure # run: ./configure
- name: Linux libraries - name: Linux libraries

View File

@ -485,19 +485,15 @@ install(TARGETS 3proxy mycrypt proxy socks pop3p smtpp ftppr tcppm udppm tlspr
) )
# Install plugins # Install plugins
file(GLOB PLUGINFILES "${PLUGIN_OUTPUT_DIR}/*${PLUGIN_SUFFIX}")
if(WIN32) if(WIN32)
install(FILES install(FILES
${PLUGIN_OUTPUT_DIR}/utf8tocp1251${PLUGIN_SUFFIX} ${PLUGINFILES}
${PLUGIN_OUTPUT_DIR}/WindowsAuthentication${PLUGIN_SUFFIX}
${PLUGIN_OUTPUT_DIR}/TrafficPlugin${PLUGIN_SUFFIX}
${PLUGIN_OUTPUT_DIR}/StringsPlugin${PLUGIN_SUFFIX}
DESTINATION ${CMAKE_INSTALL_BINDIR} DESTINATION ${CMAKE_INSTALL_BINDIR}
) )
else() else()
install(FILES install(FILES
${PLUGIN_OUTPUT_DIR}/StringsPlugin${PLUGIN_SUFFIX} ${PLUGINFILES}
${PLUGIN_OUTPUT_DIR}/TrafficPlugin${PLUGIN_SUFFIX}
${PLUGIN_OUTPUT_DIR}/TransparentPlugin${PLUGIN_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/3proxy DESTINATION ${CMAKE_INSTALL_LIBDIR}/3proxy
) )
endif() endif()

View File

@ -148,6 +148,6 @@ install-log:
install: install-chroot-dir install-bin install-etc install-log install-man install-run install-init install: install-chroot-dir install-bin install-etc install-log install-man install-run install-init
@if [ "$(DESTDIR)" = "" ]; then \ @if [ "$(DESTDIR)" = "" ]; then \
sh scripts/debian/preinst; \ sh debian/preinst; \
sh scripts/debian/postinst; \ sh debian/postinst; \
fi fi

View File

@ -6,13 +6,9 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = cl CC = cl
CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "PRIx64=\"I64x\"" /Fp"proxy.pch" /FD /c VERSION = $(VERSION)
!IFDEF RELEASE BUILDDATE = $(BUILDDATE)
VERSION=/D VERSION=\"3proxy-$(RELEASE)\" CFLAGS = /nologo /MT /W3 /Ox /GS /EHs- /GA /GF /D "MSVC" /D "WITH_WSAPOLL" /D "NDEBUG" /D "WIN32" /D "WITH_SSL" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /Fp"proxy.pch" /FD /c $(BUILDDATE) $(VERSION)
!ENDIF
!IFDEF NOW
BUILDDATE=/D BUILDDATE=\"$(NOW)\"
!ENDIF
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no LDFLAGS = /nologo /subsystem:console /incremental:no
@ -33,9 +29,7 @@ COMPATLIBS =
MAKEFILE = Makefile.msvc MAKEFILE = Makefile.msvc
PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin SSLPlugin PCREPlugin PLUGINS = utf8tocp1251 WindowsAuthentication TrafficPlugin StringsPlugin FilePlugin SSLPlugin PCREPlugin
VERFILE = 3proxy.res $(VERFILE) VERFILE = 3proxy.res $(VERFILE)
VERSION = $(VERSION)
VERSIONDEP = 3proxy.res $(VERSIONDEP) VERSIONDEP = 3proxy.res $(VERSIONDEP)
BUILDDATE = $(BUILDDATE)
AFTERCLEAN = if exist src\*.res (del src\*.res) && if exist src\*.err (del src\*.err) AFTERCLEAN = if exist src\*.res (del src\*.res) && if exist src\*.err (del src\*.err)
include Makefile.inc include Makefile.inc

View File

@ -6,7 +6,7 @@
BUILDDIR = ../bin/ BUILDDIR = ../bin/
CC = cl CC = cl
CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "PRIx64=\"I64x\"" /c $(VERSION) $(BUILDDATE) CFLAGS = /nologo /Ox /MT /D "NOIPV6" /D "NODEBUG" /D "NOODBC" /D "NORADIUS" /D"WATCOM" /D "MSVC" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "_WIN32" /D "PRId64=\"I64d\"" /D "PRIu64=\"I64u\"" /D "SCNu64=\"I64u\"" /D "SCNx64=\"I64x\"" /D "SCNd64=\"I64d\"" /D "PRIx64=\"I64x\"" /c $(VERSION) $(BUILDDATE)
COUT = /Fo COUT = /Fo
LN = link LN = link
LDFLAGS = /nologo /subsystem:console /incremental:no LDFLAGS = /nologo /subsystem:console /incremental:no
@ -62,9 +62,3 @@ allplugins:
nmake nmake
del *.obj *.idb del *.obj *.idb
cd ../../ cd ../../
copy Makefile plugins\PCREPlugin
copy Makefile.var plugins\PCREPlugin
cd plugins\PCREPlugin
nmake
del *.obj *.idb
cd ../../

View File

@ -4,30 +4,6 @@
# This file defines functions for building plugins # This file defines functions for building plugins
# #
# Function to add a simple plugin (single source file, no dependencies)
function(add_3proxy_plugin_simple PLUGIN_NAME SOURCE_FILE)
if(WIN32)
set(PLUGIN_SUFFIX ".dll")
else()
set(PLUGIN_SUFFIX ".ld.so")
endif()
add_library(${PLUGIN_NAME} SHARED ${SOURCE_FILE})
set_target_properties(${PLUGIN_NAME} PROPERTIES
PREFIX ""
SUFFIX ${PLUGIN_SUFFIX}
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
target_link_libraries(${PLUGIN_NAME} PRIVATE Threads::Threads)
target_include_directories(${PLUGIN_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src
)
endfunction()
# Function to add a plugin with dependencies # Function to add a plugin with dependencies
function(add_3proxy_plugin PLUGIN_NAME) function(add_3proxy_plugin PLUGIN_NAME)
set(options "") set(options "")

4
debian/conffiles vendored
View File

@ -1,4 +0,0 @@
/usr/local/3proxy/conf/3proxy.cfg
/usr/local/3proxy/conf/add3proxyuser.sh
/usr/local/3proxy/conf/bandlimiters
/usr/local/3proxy/conf/counters

14
debian/postinst vendored
View File

@ -1,10 +1,3 @@
if [ ! -f /usr/local/3proxy/conf/passwd ]; then \
touch /usr/local/3proxy/conf/passwd;\
fi
chown -R proxy:proxy /usr/local/3proxy
chmod 550 /usr/local/3proxy/
chmod 550 /usr/local/3proxy/conf/
chmod 440 /usr/local/3proxy/conf/*
if /bin/systemctl >/dev/null 2>&1; then \ if /bin/systemctl >/dev/null 2>&1; then \
/usr/sbin/update-rc.d 3proxy disable || true; \ /usr/sbin/update-rc.d 3proxy disable || true; \
/usr/sbin/chkconfig 3proxy off || true; \ /usr/sbin/chkconfig 3proxy off || true; \
@ -34,10 +27,3 @@ elif [ -x /usr/sbin/service ]; then \
echo " "service 3proxy stop ;\ echo " "service 3proxy stop ;\
echo to stop proxy ;\ echo to stop proxy ;\
fi fi
echo " "/usr/local/3proxy/conf/add3proxyuser.sh
echo to add users
echo ""
echo Default config uses Google\'s DNS.
echo It\'s recommended to use provider supplied DNS or install local recursor, e.g. pdns-recursor.
echo Configure preferred DNS in /usr/local/3proxy/conf/3proxy.cfg.
echo run \'/usr/local/3proxy/conf/add3proxyuser.sh admin password\' to configure \'admin\' user

6
debian/rules vendored
View File

@ -3,14 +3,8 @@
%: %:
dh $@ dh $@
override_dh_auto_build:
ln -s Makefile.Linux Makefile || true
dh_auto_build
override_dh_auto_clean: override_dh_auto_clean:
find src/ -type f -name "*.o" -delete find src/ -type f -name "*.o" -delete
find src/ -type f -name "Makefile.var" -delete find src/ -type f -name "Makefile.var" -delete
find bin/ -type f -executable -delete find bin/ -type f -executable -delete
rm -f Makefile
override_dh_usrlocal:

View File

@ -67,14 +67,10 @@
<ul> <ul>
<li><A NAME="MSVC">How to compile 3proxy with Visual C++</A> <li><A NAME="MSVC">How to compile 3proxy with Visual C++</A>
<p> <p>
Extract source code files from 3proxy.tgz (with WinZip or another utility). Extract source code files from 3proxy.tgz (with WinZip or another utility) or use git.
For 64-bit Windows use:
<pre> <pre>
nmake /f Makefile.msvc64 nmake /f Makefile.msvc
</pre>
For ARM64 Windows use:
<pre>
nmake /f Makefile.msvcARM64
</pre> </pre>
Binaries will be placed in the <code>bin/</code> directory. Binaries will be placed in the <code>bin/</code> directory.
</p> </p>

View File

@ -73,13 +73,10 @@
<ul> <ul>
<li><a name="MSVC"><i>Как скомпилировать 3proxy Visual C++</i></a> <li><a name="MSVC"><i>Как скомпилировать 3proxy Visual C++</i></a>
<p> <p>
Извлеките файлы из архива 3proxy.tgz (например, с помощью WinZip). Извлеките файлы из архива 3proxy.tgz (например, с помощью WinZip) или используйте git.
Для 64-битной Windows используйте:
<pre> <pre>
nmake /f Makefile.msvc64</pre> nmake /f Makefile.msvc
Для Windows ARM64 используйте: </pre>
<pre>
nmake /f Makefile.msvcARM64</pre>
Исполняемые файлы будут помещены в каталог <code>bin/</code>. Исполняемые файлы будут помещены в каталог <code>bin/</code>.
</p> </p>
<li><a name="CMAKE"><i>Как скомпилировать 3proxy с помощью CMake</i></a> <li><a name="CMAKE"><i>Как скомпилировать 3proxy с помощью CMake</i></a>

View File

@ -57,11 +57,11 @@ connections and UDP portmapping.</p>
cellspacing="0" cellpadding="0"> cellspacing="0" cellpadding="0">
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-I</b></p></td> <p style="margin-top: 1em"><b>-I</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -69,11 +69,11 @@ connections and UDP portmapping.</p>
only.</p> </td></tr> only.</p> </td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-d</b></p></td> <p style="margin-top: 1em"><b>-d</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -81,11 +81,11 @@ only.</p> </td></tr>
console and run in the background.</p></td></tr> console and run in the background.</p></td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-t</b></p></td> <p style="margin-top: 1em"><b>-t</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -93,11 +93,11 @@ console and run in the background.</p></td></tr>
start/stop/accept error records.</p></td></tr> start/stop/accept error records.</p></td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-u</b></p></td> <p style="margin-top: 1em"><b>-u</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -105,11 +105,11 @@ start/stop/accept error records.</p></td></tr>
authentication</p> </td></tr> authentication</p> </td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-e</b></p></td> <p style="margin-top: 1em"><b>-e</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -120,25 +120,43 @@ connections. By default, the system will decide which
address to use in accordance with the routing table.</p></td></tr> address to use in accordance with the routing table.</p></td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-N</b></p></td> <p style="margin-top: 1em"><b>-Ne</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
<p style="margin-top: 1em">External NAT address 3proxy <p style="margin-top: 1em">External NAT address 3proxy
reports to client for BIND and UDPASSOC. By default, the reports to client for CONNECT/BIND. This is external address
external address is reported. It&rsquo;s only useful in the of NAT between 3proxy and destination server. By default,
case of IP-IP NAT (will not work for PAT).</p></td></tr> the external address is reported. It&rsquo;s only useful in
the case of IP-IP NAT and does not work with port
translation.</p> </td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-Ni</b></p></td>
<td width="5%"></td>
<td width="85%">
<p style="margin-top: 1em">Internal NAT address 3proxy
reports to client for UDPASSOC. This is external address of
the NAT between 3proxy and the client, client uses to
connect to 3proxy. By default, the internal address is
reported. It&rsquo;s only useful in the case of IP-IP NAT
and does not work with port translation.</p></td></tr>
<tr valign="top" align="left">
<td width="6%"></td>
<td width="4%">
<p style="margin-top: 1em"><b>-i</b></p></td> <p style="margin-top: 1em"><b>-i</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -147,11 +165,11 @@ proxy accepts connections to. By default, connections to any
interface are accepted. It&acute;s usually unsafe.</p></td></tr> interface are accepted. It&acute;s usually unsafe.</p></td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-p</b></p></td> <p style="margin-top: 1em"><b>-p</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -159,11 +177,11 @@ interface are accepted. It&acute;s usually unsafe.</p></td></tr>
incoming connections. Default is 1080.</p></td></tr> incoming connections. Default is 1080.</p></td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-l</b></p></td> <p style="margin-top: 1em"><b>-l</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">
@ -173,11 +191,11 @@ Under Unix, if &acute;<i>@</i>&acute; preceeds
<i>logfile</i>, syslog is used for logging.</p></td></tr> <i>logfile</i>, syslog is used for logging.</p></td></tr>
<tr valign="top" align="left"> <tr valign="top" align="left">
<td width="6%"></td> <td width="6%"></td>
<td width="3%"> <td width="4%">
<p style="margin-top: 1em"><b>-S</b></p></td> <p style="margin-top: 1em"><b>-S</b></p></td>
<td width="6%"></td> <td width="5%"></td>
<td width="85%"> <td width="85%">

View File

@ -33,15 +33,33 @@ from. External IP must be specified if you need incoming connections.
By default, the system will decide which address to use in accordance By default, the system will decide which address to use in accordance
with the routing table. with the routing table.
.TP .TP
.B -N .B -Ne
External NAT address 3proxy reports to client for BIND and UDPASSOC. External NAT address 3proxy reports to client for CONNECT/BIND.
This is external address of NAT between 3proxy and destination server.
By default, the external address is reported. It's only useful in the case By default, the external address is reported. It's only useful in the case
of IP-IP NAT (will not work for PAT). of IP-IP NAT and does not work with port translation.
.TP
.B -Ni
Internal NAT address 3proxy reports to client for UDPASSOC.
This is external address of the NAT between 3proxy and the client, client
uses to connect to 3proxy.
By default, the internal address is reported. It's only useful in the case
of IP-IP NAT and does not work with port translation.
.TP .TP
.B -i .B -i
Internal address. IP address the proxy accepts connections to. Internal address. IP address the proxy accepts connections to.
By default, connections to any interface are accepted. It\'s usually unsafe. By default, connections to any interface are accepted. It\'s usually unsafe.
.TP .TP
.B -k
External address given by
.B -e
is ignored and the internal address or generally the address client conected to is used instead.
This allows to utilize AnyIP Linux feature when
.B -i0.0.0.0
or in case of IPv6
.B -i::
is set. Not available for Windows platform.
.TP
.B -p .B -p
Port. Port proxy listens for incoming connections. Default is 1080. Port. Port proxy listens for incoming connections. Default is 1080.
.TP .TP

View File

@ -563,16 +563,48 @@ int doconnect(struct clientparam * param){
if(!*SAPORT(&param->sinsr))*SAPORT(&param->sinsr) = *SAPORT(&param->req); if(!*SAPORT(&param->sinsr))*SAPORT(&param->sinsr) = *SAPORT(&param->req);
if ((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&param->sinsr), SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {return (11);} if ((param->remsock=param->srv->so._socket(param->sostate, SASOCK(&param->sinsr), SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) {return (11);}
if(SAISNULL(&param->sinsl)){ if(SAISNULL(&param->sinsl)){
if (param->srv->keepip) {
#ifndef NOIPV6
struct sockaddr_in6 local_addr;
socklen_t local_addr_len = sizeof(local_addr);
getsockname(param->clisock, (struct sockaddr *)&local_addr, &local_addr_len);
if(*SAFAMILY(&local_addr) == AF_INET6) {
if (IN6_IS_ADDR_V4MAPPED(&local_addr.sin6_addr)) {
struct sockaddr_in6 local_addr2;
memset(&local_addr2, 0, sizeof(local_addr2));
local_addr2.sin6_family = AF_INET;
local_addr2.sin6_port = local_addr.sin6_port;
param->sinsl = local_addr2;
} else {
param->sinsl = local_addr;
}
} else {
param->sinsl = local_addr;
}
#else
struct sockaddr_in local_addr;
socklen_t local_addr_len = sizeof(local_addr);
getsockname(new_sock, (struct sockaddr *)&local_addr, &local_addr_len);
param->sinsl = local_addr;
#endif
} else {
#ifndef NOIPV6 #ifndef NOIPV6
if(*SAFAMILY(&param->sinsr) == AF_INET6) param->sinsl = param->srv->extsa6; if(*SAFAMILY(&param->sinsr) == AF_INET6) param->sinsl = param->srv->extsa6;
else else
#endif #endif
param->sinsl = param->srv->extsa; param->sinsl = param->srv->extsa;
} }
}
*SAPORT(&param->sinsl) = 0; *SAPORT(&param->sinsl) = 0;
setopts(param->remsock, param->srv->srvsockopts); setopts(param->remsock, param->srv->srvsockopts);
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg)); param->srv->so._setsockopt(param->sostate, param->remsock, SOL_SOCKET, SO_LINGER, (char *)&lg, sizeof(lg));
if (param->srv->keepip) {
int opt = 1;
param->srv->so._setsockopt(param->sostate, param->remsock, SOL_IP, IP_FREEBIND, (char *)&opt, sizeof(int));
}
#ifdef REUSE #ifdef REUSE
{ {
int opt; int opt;

View File

@ -288,6 +288,9 @@ int MODULEMAINFUNC (int argc, char** argv){
"\n" "\n"
" -iIP ip address or internal interface (clients are expected to connect)\n" " -iIP ip address or internal interface (clients are expected to connect)\n"
" -eIP ip address or external interface (outgoing connection will have this)\n" " -eIP ip address or external interface (outgoing connection will have this)\n"
#ifndef _WIN32
" -k outgoing connection will have local IP where client connected, thus ignores -e (useful in AnyIP case)\n"
#endif
" -rHOST:PORT Use IP:port for connect back proxy instead of listen port\n" " -rHOST:PORT Use IP:port for connect back proxy instead of listen port\n"
" -RHOST:PORT Use PORT to listen connect back proxy connection to pass data to\n" " -RHOST:PORT Use PORT to listen connect back proxy connection to pass data to\n"
" -4 Use IPv4 for outgoing connections\n" " -4 Use IPv4 for outgoing connections\n"
@ -426,8 +429,17 @@ int MODULEMAINFUNC (int argc, char** argv){
#endif #endif
} }
break; break;
#ifndef _WIN32
case 'k':
{
srv.keepip = 1;
}
break;
#endif
case 'N': case 'N':
getip46(46, (unsigned char *)argv[i]+2, (struct sockaddr *)&srv.extNat); if(argv[i][3] == 'e') getip46(46, (unsigned char *)argv[i]+3, (struct sockaddr *)&srv.extNat);
else if(argv[i][3] == 'i') getip46(46, (unsigned char *)argv[i]+3, (struct sockaddr *)&srv.intNat);
else getip46(46, (unsigned char *)argv[i]+2, (struct sockaddr *)&srv.extNat);
break; break;
case 'p': case 'p':
*SAPORT(&srv.intsa) = htons(atoi(argv[i]+2)); *SAPORT(&srv.intsa) = htons(atoi(argv[i]+2));
@ -815,6 +827,7 @@ int MODULEMAINFUNC (int argc, char** argv){
} }
else { else {
new_sock = srv.so._accept(srv.so.state, sock, (struct sockaddr*)&defparam.sincr, &size); new_sock = srv.so._accept(srv.so.state, sock, (struct sockaddr*)&defparam.sincr, &size);
if(new_sock == INVALID_SOCKET){ if(new_sock == INVALID_SOCKET){
#ifdef _WIN32 #ifdef _WIN32
switch(WSAGetLastError()){ switch(WSAGetLastError()){
@ -990,6 +1003,7 @@ void srvinit(struct srvparam * srv, struct clientparam *param){
srv->logdumpcli = conf.logdumpcli; srv->logdumpcli = conf.logdumpcli;
srv->cbsock = INVALID_SOCKET; srv->cbsock = INVALID_SOCKET;
srv->needuser = 1; srv->needuser = 1;
srv->keepip = 0;
#ifdef WITHSPLICE #ifdef WITHSPLICE
srv->usesplice = 1; srv->usesplice = 1;
#endif #endif

View File

@ -274,7 +274,21 @@ CLEANRET:
sasize = sizeof(sin); sasize = sizeof(sin);
if(command != 3 && param->remsock != INVALID_SOCKET) param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)&sin, &sasize); if(command != 3 && param->remsock != INVALID_SOCKET) param->srv->so._getsockname(param->sostate, param->remsock, (struct sockaddr *)&sin, &sasize);
else param->srv->so._getsockname(param->sostate, param->clisock, (struct sockaddr *)&sin, &sasize); if(!SAISNULL(&param->srv->extNat)){
uint16_t port;
port = *SAPORT(&sin);
sin = param->srv->extNat;
*SAPORT(&sin) = port;
}
else {
param->srv->so._getsockname(param->sostate, param->clisock, (struct sockaddr *)&sin, &sasize);
if(!SAISNULL(&param->srv->intNat)){
uint16_t port;
port = *SAPORT(&sin);
sin = param->srv->intNat;
*SAPORT(&sin) = port;
}
}
#if SOCKSTRACE > 0 #if SOCKSTRACE > 0
myinet_ntop(*SAFAMILY(&sin), &sin, tracebuf, SASIZE(&sin)); myinet_ntop(*SAFAMILY(&sin), &sin, tracebuf, SASIZE(&sin));
fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n", fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n",
@ -518,7 +532,9 @@ struct proxydef childdef = {
1080, 1080,
0, 0,
S_SOCKS, S_SOCKS,
"-N(EXTERNAL_IP) External NAT address to report to client for BIND\n" "-Ne(EXTERNAL_IP) External NAT address (between 3proxy and destination server) to report to client for CONNECT / BIND\n"
"-Ni(INTERNAL_IP) Internal NAT address (between client and 3proxy) to report to client for UDPASSOC\n"
"NAT is required to map IP-to-IP without port translation\n"
}; };
#include "proxymain.c" #include "proxymain.c"
#endif #endif

View File

@ -493,6 +493,7 @@ struct srvparam {
int paused, version; int paused, version;
int singlepacket; int singlepacket;
int usentlm; int usentlm;
int keepip;
int needuser; int needuser;
int silent; int silent;
int transparent; int transparent;
@ -515,10 +516,12 @@ struct srvparam {
struct sockaddr_in6 extsa6; struct sockaddr_in6 extsa6;
struct sockaddr_in6 extsa; struct sockaddr_in6 extsa;
struct sockaddr_in6 extNat; struct sockaddr_in6 extNat;
struct sockaddr_in6 intNat;
#else #else
struct sockaddr_in intsa; struct sockaddr_in intsa;
struct sockaddr_in extsa; struct sockaddr_in extsa;
struct sockaddr_in extNat; struct sockaddr_in extNat;
struct sockaddr_in intNat;
#endif #endif
pthread_mutex_t counter_mutex; pthread_mutex_t counter_mutex;
struct pollfd fds; struct pollfd fds;

View File

@ -9,4 +9,6 @@
#define MINOR3PROXY 5 #define MINOR3PROXY 5
#define SUBMINOR3PROXY 0 #define SUBMINOR3PROXY 0
#define RELEASE3PROXY "3proxy-0.9.5(" BUILDDATE ")\0" #define RELEASE3PROXY "3proxy-0.9.5(" BUILDDATE ")\0"
#ifndef YEAR3PROXY
#define YEAR3PROXY "2026" #define YEAR3PROXY "2026"
#endif