Package Details: mtproxy-git 47.dc0c7f3-2

Git Clone URL: https://aur.archlinux.org/mtproxy-git.git (read-only, click to copy)
Package Base: mtproxy-git
Description: Proxy server for Telegram messaging app
Upstream URL: https://github.com/TelegramMessenger/MTProxy
Licenses: GPLv2, LGPLv2
Submitter: None
Maintainer: legeana
Last Packager: legeana
Votes: 6
Popularity: 0.000268
First Submitted: 2018-05-31 12:40 (UTC)
Last Updated: 2020-07-08 11:07 (UTC)

Latest Comments

1 2 Next › Last »

shervinkh commented on 2020-07-07 23:27 (UTC)

The latest version does not compile with gcc-10. One needs to add "-fcommon" to CFLAGS and/or LDFLAGS in the Makefile in order to compile successfully.

Nebulosa commented on 2019-12-07 19:09 (UTC) (edited on 2019-12-07 19:09 (UTC) by Nebulosa)

Yep, that was my mistake. Thanks a lot!

legeana commented on 2019-12-04 22:53 (UTC) (edited on 2019-12-04 22:55 (UTC) by legeana)

Hi Nebulosa, the service files sets EnvironmentFile to /etc/mtproxy.conf, could you please take a look if you have every single variable present there? /etc/mtproxy.conf should look similar to:

USER=nobody
STATS_PORT=XXX
CLIENT_PORT=YYY
SECRET=ZZZ
ARGS=

Are you able to run it without service file?

$ /usr/bin/mtproto-proxy --port=XXX --http-ports=YYY --mtproto-secret=ZZZ --aes-pwd=/var/lib/mtproxy/secret.conf /var/lib/mtproxy/multi.conf

Do you have ipv6 enabled/disabled by any chance? Could it be somehow affecting the startup?

If the binary fails to run with just a command line (without systemd) you could also try to run it with strace, aka strace -f -s 100000 actual_command and see where it fails.

Nebulosa commented on 2019-12-03 18:27 (UTC) (edited on 2019-12-03 18:37 (UTC) by Nebulosa)

Smthg wrong with parameter substitution in mtproxy.service:

mtproxy.service - Telegram proxy server

Loaded: loaded (/usr/lib/systemd/system/mtproxy.service; disabled; vendor preset: disabled)

Active: failed (Result: exit-code)

Process: 29148 ExecStart=/usr/bin/mtproto-proxy --user=${USER} --port=${STATS_PORT} --http-ports=${CLIENT_PORT} --mtproto-secret=${SECRET} --aes-pwd=/var/lib/mtproxy/secret.conf $ARGS /var/lib/mtproxy/multi.conf (code=exited, status=2)

Main PID: 29148 (code=exited, status=2)

systemd[1]: mtproxy.service: Service RestartSec=100ms expired, scheduling restart.

systemd[1]: mtproxy.service: Scheduled restart job, restart counter is at 3.

systemd[1]: Stopped Telegram proxy server.

systemd[1]: mtproxy.service: Start request repeated too quickly.

systemd[1]: mtproxy.service: Failed with result 'exit-code'.

systemd[1]: Failed to start Telegram proxy server.

legeana commented on 2019-11-18 22:05 (UTC)

Unfortunately it's too too late to fix that :)

dronskii commented on 2019-11-18 22:02 (UTC)

Sorry, shouldn't have been so hasty to upload my patch. Thanks for making it better. BTW the commit message should've been "removed pid is 16 bit assertion" - i miswrote...

legeana commented on 2019-11-18 13:17 (UTC) (edited on 2019-11-18 13:17 (UTC) by legeana)

Hi Yaroslav, thank you for the patch. I've mostly applied the patch you crafted with the exception of few details.

  1. https://wiki.archlinux.org/index.php/PKGBUILD#makedepends The group base-devel is assumed to be already installed when building with makepkg. Members of this group should not be included in makedepends array.

  2. try-restart instead of restart in order to avoid bringing the service up if it is not already running.

  3. ExecStartPost instead of ExecStart to emphasize the post-update nature of the command.

dronskii commented on 2019-11-15 10:59 (UTC) (edited on 2019-11-15 13:12 (UTC) by dronskii)

Patched for newer systemd: removed 32-bit pid assertion, also restart proxy after config update. Also put Restart=on-failure in mtproxy.service: stats are borked in ipv6 mode, some assertions need fixing... Also added makedepends: not everybody has make/patch installed :-)

commit 68644e06ef88a0294151a4e63a6e11c37c242943 (HEAD -> master)
Author: Yaroslav Dronskiy <jaroslav@dronsky.ru>
Date:   Fri Nov 15 13:49:11 2019 +0300

    Restart mtproxy after config update + remove 'pid is 32 bit' assertion

diff --git a/PKGBUILD b/PKGBUILD
index 8065417..da27a4a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -15,26 +15,29 @@
 # Maintainer: Aleksey Filippov <sarum9in@gmail.com>

 pkgname=mtproxy-git
-pkgver=17.580909c
-pkgrel=2
+pkgver=47.dc0c7f3
+pkgrel=1
 pkgdesc="Proxy server for Telegram messaging app"
 arch=('i686' 'x86_64')
 url='https://github.com/TelegramMessenger/MTProxy'
 license=('GPLv2' 'LGPLv2')
 depends=('curl' 'zlib')
+makedepends=('make' 'patch')
 source=(
     "$pkgname::git+https://github.com/TelegramMessenger/MTProxy.git"
     mtproxy.conf
     mtproxy-config.service
     mtproxy-config.timer
     mtproxy.service
+    pid_assertion.patch
 )
 noextract=()
 md5sums=('SKIP'
          '1a9cdcef498d2e9ffb5def0112c3e2b0'
-         '6ceb39b6a8462bc21c0940fd6ca5650e'
+         '4a7fb1d2c7cd60563d13949dddd7f694'
          'aa2367c3f759632473824fabcc3544ff'
-         'c08b4b281c1e8c8587b04743f70cff0d')
+         '1ee66acee6c42aca9160b9ccfe534bc3'
+         '50233354ac78d52280a93092b809f7aa')
 backup=('etc/mtproxy.conf')

 pkgver() {
@@ -42,6 +45,11 @@ pkgver() {
   echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
 }

+prepare() {
+    cd "$srcdir/$pkgname"
+    patch --forward --strip=1 --input="${srcdir}/pid_assertion.patch"
+}
+
 build() {
   cd "$srcdir/$pkgname"
   make $MFLAGS
diff --git a/mtproxy-config.service b/mtproxy-config.service
index 7ec0135..1412e28 100644
--- a/mtproxy-config.service
+++ b/mtproxy-config.service
@@ -7,4 +7,5 @@ Wants=network-online.target
 Type=oneshot
 ExecStart=/usr/bin/curl -s https://core.telegram.org/getProxyConfig -o /var/lib/mtproxy/multi.conf
 ExecStart=/usr/bin/curl -s https://core.telegram.org/getProxySecret -o /var/lib/mtproxy/secret.conf
+ExecStart=/usr/bin/systemctl restart mtproxy.service
 StandardError=journal
diff --git a/mtproxy.service b/mtproxy.service
index d91010d..3934b41 100644
--- a/mtproxy.service
+++ b/mtproxy.service
@@ -7,6 +7,7 @@ Wants=network-online.target
 [Service]
 Type=simple
 EnvironmentFile=/etc/mtproxy.conf
+Restart=on-failure
 ExecStart=/usr/bin/mtproto-proxy \
     --user=${USER} \
     --port=${STATS_PORT} \
diff --git a/pid_assertion.patch b/pid_assertion.patch
new file mode 100644
index 0000000..1e55b67
--- /dev/null
+++ b/pid_assertion.patch
@@ -0,0 +1,12 @@
+diff --git a/common/pid.c b/common/pid.c
+index 7bd4b8d..8904cc7 100644
+--- a/common/pid.c
++++ b/common/pid.c
+@@ -39,7 +39,6 @@ npid_t PID;
+ void init_common_PID (void) {
+   if (!PID.pid) {
+     int p = getpid ();
+-    assert (!(p & 0xffff0000));
+     PID.pid = p;
+   }
+   if (!PID.utime) {

<deleted-account> commented on 2018-06-06 10:23 (UTC)

Good catch, thank you.

levitsky commented on 2018-06-06 10:11 (UTC) (edited on 2018-06-06 10:13 (UTC) by levitsky)

The main service fails to start on boot with a dependency error on my VPS:

systemd[1]: Dependency failed for Telegram proxy server.
systemd[1]: mtproxy.service: Job mtproxy.service/start failed with result 'dependency'

The failed dependency is actually mtproxy-config.service, which fails when called because the network is still not configured:

systemd[1]: Starting Updates Telegram configuration...
systemd[1]: mtproxy-config.service: Main process exited, code=exited, status=6/NOTCONFIGURED
systemd[1]: mtproxy-config.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Updates Telegram configuration.

I fixed this by adding

Requires=network-online.target
After=network-online.target

in the mtproxy-config.service file.