mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-26 23:52:51 +08:00
✨ Sync 2026-04-23 03:02:20
This commit is contained in:
1 parent
707fbd9449
commit
186f3f4b2d
16 files changed
+341
-336
No files matched your search
@@ -0,0 +1,35 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=teleproxy
|
||||
PKG_VERSION:=4.11.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MAINTAINER:=Kosntantine Shevlakov <shevlakov@132lan.ru>
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/teleproxy/teleproxy.git
|
||||
PKG_SOURCE_VERSION:=09b1ae9c39c456a7b91d24fdd3597ea08519ef22
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SUBMENU:=Web Servers/Proxies
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=MTProxy OpenWRT package
|
||||
DEPENDS:=+libopenssl +zlib
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/objs/bin/* \
|
||||
$(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
@@ -0,0 +1,20 @@
|
||||
Index: teleproxy/Makefile
|
||||
===================================================================
|
||||
--- teleproxy.orig/Makefile
|
||||
+++ teleproxy/Makefile
|
||||
@@ -56,11 +56,11 @@ COMMON_CFLAGS += $(EXTRA_CFLAGS)
|
||||
COMMON_LDFLAGS += $(EXTRA_LDFLAGS)
|
||||
|
||||
# Architecture-specific CFLAGS
|
||||
-ifeq ($(HOST_ARCH), x86_64)
|
||||
+ifeq ($(ARCH), x86_64)
|
||||
CFLAGS := $(COMMON_CFLAGS) -mpclmul -march=core2 -mfpmath=sse -mssse3 $(BITNESS_FLAGS)
|
||||
-else ifeq ($(HOST_ARCH), aarch64)
|
||||
-CFLAGS := $(COMMON_CFLAGS) $(BITNESS_FLAGS)
|
||||
-else ifeq ($(HOST_ARCH), arm64)
|
||||
+else ifeq ($(ARCH), mipsel)
|
||||
+CFLAGS := $(COMMON_CFLAGS) $(BITNESS_FLAGS) -march=mips32r2 -Wno-builtin-declaration-mismatch
|
||||
+else
|
||||
CFLAGS := $(COMMON_CFLAGS) $(BITNESS_FLAGS)
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Index: teleproxy/src/mtproto/mtproto-proxy-stats.c
|
||||
===================================================================
|
||||
--- teleproxy.orig/src/mtproto/mtproto-proxy-stats.c
|
||||
+++ teleproxy/src/mtproto/mtproto-proxy-stats.c
|
||||
@@ -602,9 +602,9 @@ void mtfront_prepare_stats (stats_buffer
|
||||
if (_quota > 0) {
|
||||
sb_printf (sb, "secret_%s_quota\t%lld\n", _lbl, _quota);
|
||||
}
|
||||
- int _mips = tcp_rpcs_get_ext_secret_max_ips (_i);
|
||||
- if (_mips > 0) {
|
||||
- sb_printf (sb, "secret_%s_max_ips\t%d\n", _lbl, _mips);
|
||||
+ int _mips_ips = tcp_rpcs_get_ext_secret_max_ips (_i);
|
||||
+ if (_mips_ips > 0) {
|
||||
+ sb_printf (sb, "secret_%s_max_ips\t%d\n", _lbl, _mips_ips);
|
||||
}
|
||||
int64_t _exp = tcp_rpcs_get_ext_secret_expires (_i);
|
||||
if (_exp > 0) {
|
||||
@@ -0,0 +1,86 @@
|
||||
Index: teleproxy/src/common/rdtsc_32bit.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ teleproxy/src/common/rdtsc_32bit.h
|
||||
@@ -0,0 +1,14 @@
|
||||
+#ifndef RDTSC_EMUL_H
|
||||
+#define RDTSC_EMUL_H
|
||||
+
|
||||
+#if defined(__arm__) || defined(__mips__) || defined(__mipsel__)
|
||||
+#include <time.h>
|
||||
+
|
||||
+static inline unsigned long long rdtsc(void) {
|
||||
+ struct timespec ts;
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
+ return (unsigned long long)ts.tv_sec * 1000000000ULL + ts.tv_nsec;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#endif
|
||||
Index: teleproxy/src/engine/engine-rpc-common.c
|
||||
===================================================================
|
||||
--- teleproxy.orig/src/engine/engine-rpc-common.c
|
||||
+++ teleproxy/src/engine/engine-rpc-common.c
|
||||
@@ -51,6 +51,7 @@
|
||||
|
||||
+#include "common/rdtsc_32bit.h"
|
||||
#include "engine/engine.h"
|
||||
#include "engine/engine-rpc-common.h"
|
||||
|
||||
#include "common/tl-parse.h"
|
||||
|
||||
Index: teleproxy/src/jobs/jobs.c
|
||||
===================================================================
|
||||
--- teleproxy.orig/src/jobs/jobs.c
|
||||
+++ teleproxy/src/jobs/jobs.c
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "net/net-connections.h"
|
||||
#include "jobs/jobs.h"
|
||||
#include "common/common-stats.h"
|
||||
+#include "common/rdtsc_32bit.h"
|
||||
|
||||
//#include "auto/engine/engine.h"
|
||||
|
||||
Index: teleproxy/src/net/net-crypto-aes.c
|
||||
===================================================================
|
||||
--- teleproxy.orig/src/net/net-crypto-aes.c
|
||||
+++ teleproxy/src/net/net-crypto-aes.c
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include "jobs/jobs.h"
|
||||
#include "common/common-stats.h"
|
||||
+#include "common/rdtsc_32bit.h"
|
||||
|
||||
#define MODULE crypto_aes
|
||||
|
||||
Index: teleproxy/src/common/precise-time.c
|
||||
===================================================================
|
||||
--- teleproxy.orig/src/common/precise-time.c
|
||||
+++ teleproxy/src/common/precise-time.c
|
||||
@@ -19,10 +19,11 @@
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
+
|
||||
#include <time.h>
|
||||
/* unistd.h defines _POSIX_TIMERS */
|
||||
#include <unistd.h>
|
||||
-
|
||||
+#include "rdtsc_32bit.h"
|
||||
#include "precise-time.h"
|
||||
|
||||
__thread int now;
|
||||
|
||||
Index: teleproxy/src/engine/engine-rpc.c
|
||||
===================================================================
|
||||
--- teleproxy.orig/src/engine/engine-rpc.c
|
||||
+++ teleproxy/src/engine/engine-rpc.c
|
||||
@@ -25,6 +25,8 @@
|
||||
Copyright 2015-2016 Telegram Messenger Inc
|
||||
2015-2016 Vitaliy Valtman
|
||||
*/
|
||||
+#include "common/rdtsc_32bit.h"
|
||||
+
|
||||
#include "engine/engine-rpc.h"
|
||||
#include "common/tl-parse.h"
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
Index: teleproxy/src/common/atomic_32bit.c
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ teleproxy/src/common/atomic_32bit.c
|
||||
@@ -0,0 +1,73 @@
|
||||
+#if defined(__arm__) || defined(__mips__) || defined(__mipsel__)
|
||||
+
|
||||
+#include <pthread.h>
|
||||
+#include <stdint.h>
|
||||
+
|
||||
+static pthread_mutex_t atomic_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
+
|
||||
+/* 64-bit atomic operations emulation */
|
||||
+uint64_t __sync_fetch_and_add_8(uint64_t *ptr, uint64_t val) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ uint64_t old = *ptr;
|
||||
+ *ptr += val;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return old;
|
||||
+}
|
||||
+
|
||||
+uint64_t __sync_fetch_and_sub_8(uint64_t *ptr, uint64_t val) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ uint64_t old = *ptr;
|
||||
+ *ptr -= val;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return old;
|
||||
+}
|
||||
+
|
||||
+uint64_t __sync_fetch_and_or_8(uint64_t *ptr, uint64_t val) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ uint64_t old = *ptr;
|
||||
+ *ptr |= val;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return old;
|
||||
+}
|
||||
+
|
||||
+uint64_t __sync_fetch_and_and_8(uint64_t *ptr, uint64_t val) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ uint64_t old = *ptr;
|
||||
+ *ptr &= val;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return old;
|
||||
+}
|
||||
+
|
||||
+uint64_t __sync_add_and_fetch_8(uint64_t *ptr, uint64_t val) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ *ptr += val;
|
||||
+ uint64_t newval = *ptr;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return newval;
|
||||
+}
|
||||
+
|
||||
+uint64_t __sync_sub_and_fetch_8(uint64_t *ptr, uint64_t val) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ *ptr -= val;
|
||||
+ uint64_t newval = *ptr;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return newval;
|
||||
+}
|
||||
+
|
||||
+int __sync_bool_compare_and_swap_8(uint64_t *ptr, uint64_t oldval, uint64_t newval) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ int ret = (*ptr == oldval);
|
||||
+ if (ret) *ptr = newval;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+uint64_t __sync_val_compare_and_swap_8(uint64_t *ptr, uint64_t oldval, uint64_t newval) {
|
||||
+ pthread_mutex_lock(&atomic_mutex);
|
||||
+ uint64_t old = *ptr;
|
||||
+ if (old == oldval) *ptr = newval;
|
||||
+ pthread_mutex_unlock(&atomic_mutex);
|
||||
+ return old;
|
||||
+}
|
||||
+
|
||||
+#endif /* 32bits arch */
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
Index: teleproxy/Makefile
|
||||
===================================================================
|
||||
--- teleproxy.orig/Makefile
|
||||
+++ teleproxy/Makefile
|
||||
@@ -92,6 +92,7 @@ DEPENDENCE_STRANGE := $(subst ${OBJ}/,${
|
||||
DEPENDENCE_NORM := $(subst ${OBJ}/,${DEP}/,$(patsubst %.o,%.d,${OBJECTS}))
|
||||
|
||||
LIB_OBJS_NORMAL := \
|
||||
+ ${OBJ}/src/common/atomic_32bit.o \
|
||||
${OBJ}/src/common/crc32c.o \
|
||||
${OBJ}/src/common/pid.o \
|
||||
${OBJ}/src/common/sha1.o \
|
||||
@@ -0,0 +1,22 @@
|
||||
Index: teleproxy/src/engine/engine.c
|
||||
===================================================================
|
||||
--- teleproxy.orig/src/engine/engine.c
|
||||
+++ teleproxy/src/engine/engine.c
|
||||
@@ -612,8 +612,15 @@ void engine_startup (engine_t *E, server
|
||||
precise_now_diff = get_utime_monotonic () - get_double_time ();
|
||||
|
||||
#ifdef __linux__
|
||||
- assert (SIGRTMAX == OUR_SIGRTMAX);
|
||||
- assert (SIGRTMAX - SIGRTMIN >= 20);
|
||||
+ #ifdef __mips__
|
||||
+ if (SIGRTMAX != OUR_SIGRTMAX) {
|
||||
+ vkprintf(0, "MIPS: SIGRTMAX mismatch (libc=%d, expected=%d), continuing\n",
|
||||
+ SIGRTMAX, OUR_SIGRTMAX);
|
||||
+ }
|
||||
+ #else
|
||||
+ assert(SIGRTMAX == OUR_SIGRTMAX);
|
||||
+ #endif
|
||||
+ assert(SIGRTMAX - SIGRTMIN >= 20);
|
||||
#endif
|
||||
|
||||
E->sfd = 0;
|
||||
Reference in new issue
Block a user