mirror of
https://github.com/kenzok8/small-package
synced 2025-01-07 07:06:58 +08:00
update 2024-06-19 04:19:29
This commit is contained in:
parent
2478369c37
commit
e31308166b
53
UA2F/.clang-format
Normal file
53
UA2F/.clang-format
Normal file
@ -0,0 +1,53 @@
|
||||
---
|
||||
Language: Cpp
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignOperands: false
|
||||
AlignTrailingComments: false
|
||||
AlwaysBreakTemplateDeclarations: Yes
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
AfterEnum: true
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterStruct: true
|
||||
AfterUnion: true
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
BeforeLambdaBody: true
|
||||
BeforeWhile: true
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBraces: Attach
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 120
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
IncludeCategories:
|
||||
- Regex: '^<.*'
|
||||
Priority: 1
|
||||
- Regex: '^".*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IndentCaseBlocks: true
|
||||
IndentWidth: 4
|
||||
InsertNewlineAtEOF: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 2
|
||||
NamespaceIndentation: All
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
TabWidth: 4
|
||||
...
|
@ -45,10 +45,7 @@ add_compile_definitions(UA2F_GIT_BRANCH="${GIT_BRANCH}")
|
||||
add_compile_definitions(UA2F_GIT_TAG="${GIT_TAG}")
|
||||
add_compile_definitions(UA2F_VERSION="${UA2F_VERSION_STR}")
|
||||
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(__malloc_hook "malloc.h" IS_LIBC_GLIBC)
|
||||
|
||||
if (IS_LIBC_GLIBC)
|
||||
if (UA2F_ENABLE_ASAN)
|
||||
add_compile_options(-fsanitize=address)
|
||||
add_link_options(-fsanitize=address)
|
||||
else ()
|
||||
@ -97,7 +94,6 @@ if (UA2F_BUILD_TESTS)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
cmake_policy(SET CMP0135 NEW)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
@ -111,6 +107,7 @@ if (UA2F_BUILD_TESTS)
|
||||
add_executable(
|
||||
ua2f_test
|
||||
test/util_test.cc
|
||||
test/cache_test.cc
|
||||
src/util.c
|
||||
src/cache.c
|
||||
src/cli.c
|
||||
|
@ -2,13 +2,17 @@
|
||||
#include "third/uthash.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
pthread_rwlock_t cacheLock;
|
||||
|
||||
struct cache *not_http_dst_cache = NULL;
|
||||
static int check_interval;
|
||||
|
||||
_Noreturn static void check_cache() {
|
||||
while (true) {
|
||||
@ -18,7 +22,7 @@ _Noreturn static void check_cache() {
|
||||
struct cache *cur, *tmp;
|
||||
|
||||
HASH_ITER(hh, not_http_dst_cache, cur, tmp) {
|
||||
if (difftime(now, cur->last_time) > CACHE_TIMEOUT) {
|
||||
if (difftime(now, cur->last_time) > check_interval * 2) {
|
||||
HASH_DEL(not_http_dst_cache, cur);
|
||||
free(cur);
|
||||
}
|
||||
@ -26,12 +30,13 @@ _Noreturn static void check_cache() {
|
||||
|
||||
pthread_rwlock_unlock(&cacheLock);
|
||||
|
||||
// wait for 1 minute
|
||||
sleep(CACHE_CHECK_INTERVAL);
|
||||
sleep(check_interval);
|
||||
}
|
||||
}
|
||||
|
||||
void init_not_http_cache() {
|
||||
void init_not_http_cache(const int interval) {
|
||||
check_interval = interval;
|
||||
|
||||
if (pthread_rwlock_init(&cacheLock, NULL) != 0) {
|
||||
syslog(LOG_ERR, "Failed to init cache lock");
|
||||
exit(EXIT_FAILURE);
|
||||
@ -45,20 +50,22 @@ void init_not_http_cache() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
syslog(LOG_INFO, "Cleanup thread created");
|
||||
|
||||
pthread_detach(cleanup_thread);
|
||||
}
|
||||
|
||||
bool cache_contains(const char* addr_port) {
|
||||
bool cache_contains(struct addr_port target) {
|
||||
pthread_rwlock_rdlock(&cacheLock);
|
||||
|
||||
struct cache *s;
|
||||
HASH_FIND_STR(not_http_dst_cache, addr_port, s);
|
||||
HASH_FIND(hh, not_http_dst_cache, &target, sizeof(struct addr_port), s);
|
||||
|
||||
pthread_rwlock_unlock(&cacheLock);
|
||||
|
||||
if (s != NULL) {
|
||||
bool ret;
|
||||
pthread_rwlock_wrlock(&cacheLock);
|
||||
if (difftime(time(NULL), s->last_time) > CACHE_TIMEOUT) {
|
||||
if (difftime(time(NULL), s->last_time) > check_interval * 2) {
|
||||
HASH_DEL(not_http_dst_cache, s);
|
||||
free(s);
|
||||
ret = false;
|
||||
@ -73,19 +80,18 @@ bool cache_contains(const char* addr_port) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void cache_add(const char *addr_port) {
|
||||
void cache_add(struct addr_port addr_port) {
|
||||
pthread_rwlock_wrlock(&cacheLock);
|
||||
|
||||
struct cache *s;
|
||||
HASH_FIND_STR(not_http_dst_cache, addr_port, s);
|
||||
if (s != NULL) {
|
||||
s->last_time = time(NULL);
|
||||
} else {
|
||||
|
||||
HASH_FIND(hh, not_http_dst_cache, &addr_port, sizeof(struct addr_port), s);
|
||||
if (s == NULL) {
|
||||
s = malloc(sizeof(struct cache));
|
||||
strcpy(s->addr_port, addr_port);
|
||||
s->last_time = time(NULL);
|
||||
HASH_ADD_STR(not_http_dst_cache, addr_port, s);
|
||||
memcpy(&s->target.addr, &addr_port, sizeof(struct addr_port));
|
||||
HASH_ADD(hh, not_http_dst_cache, target.addr, sizeof(struct addr_port), s);
|
||||
}
|
||||
s->last_time = time(NULL);
|
||||
|
||||
pthread_rwlock_unlock(&cacheLock);
|
||||
}
|
||||
|
@ -3,27 +3,30 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "third/nfqueue-mnl.h"
|
||||
#include "third/uthash.h"
|
||||
|
||||
#define CACHE_TIMEOUT 127
|
||||
#define CACHE_CHECK_INTERVAL 128
|
||||
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
// 1111:1111:1111:1111:1111:1111:111.111.111.111:65535
|
||||
// with null terminator
|
||||
#define MAX_ADDR_PORT_LENGTH (INET6_ADDRSTRLEN + 7)
|
||||
struct addr_port {
|
||||
ip_address_t addr;
|
||||
uint16_t port;
|
||||
};
|
||||
|
||||
struct cache {
|
||||
char addr_port[MAX_ADDR_PORT_LENGTH];
|
||||
struct addr_port target;
|
||||
time_t last_time;
|
||||
UT_hash_handle hh;
|
||||
};
|
||||
|
||||
void init_not_http_cache();
|
||||
extern struct cache *not_http_dst_cache;
|
||||
extern pthread_rwlock_t cacheLock;
|
||||
|
||||
void init_not_http_cache(int interval);
|
||||
|
||||
// add addr_port to cache, assume it's not a http dst
|
||||
void cache_add(const char* addr_port);
|
||||
void cache_add(struct addr_port addr_port);
|
||||
|
||||
bool cache_contains(const char* addr_port);
|
||||
bool cache_contains(struct addr_port addr_port);
|
||||
|
||||
#endif //UA2F_CACHE_H
|
||||
#endif // UA2F_CACHE_H
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "cli.h"
|
||||
#include "config.h"
|
||||
@ -46,4 +46,4 @@ void try_print_info(const int argc, char *argv[]) {
|
||||
printf(" --version\n");
|
||||
printf(" --help\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -21,4 +21,4 @@
|
||||
|
||||
void try_print_info(int argc, char *argv[]);
|
||||
|
||||
#endif //UA2F_CLI_H
|
||||
#endif // UA2F_CLI_H
|
||||
|
@ -1,13 +1,13 @@
|
||||
#ifdef UA2F_ENABLE_UCI
|
||||
#include <uci.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <uci.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
struct ua2f_config config = {
|
||||
.use_custom_ua = false,
|
||||
.custom_ua = NULL,
|
||||
.use_custom_ua = false,
|
||||
.custom_ua = NULL,
|
||||
};
|
||||
|
||||
void load_config() {
|
||||
@ -37,7 +37,7 @@ void load_config() {
|
||||
config.custom_ua = strdup(custom_ua);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
cleanup:
|
||||
uci_free_context(ctx);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef UA2F_ENABLE_UCI
|
||||
#ifndef UA2F_CONFIG_H
|
||||
#define UA2F_CONFIG_H
|
||||
@ -13,5 +15,5 @@ void load_config();
|
||||
|
||||
extern struct ua2f_config config;
|
||||
|
||||
#endif //UA2F_CONFIG_H
|
||||
#endif // UA2F_CONFIG_H
|
||||
#endif
|
||||
|
@ -1,18 +1,18 @@
|
||||
#include <arpa/inet.h>
|
||||
#include "handler.h"
|
||||
#include "cache.h"
|
||||
#include "util.h"
|
||||
#include "statistics.h"
|
||||
#include "custom.h"
|
||||
#include "statistics.h"
|
||||
#include "util.h"
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifdef UA2F_ENABLE_UCI
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <libnetfilter_queue/pktbuff.h>
|
||||
#include <libnetfilter_queue/libnetfilter_queue_tcp.h>
|
||||
#include <libnetfilter_queue/libnetfilter_queue_ipv4.h>
|
||||
#include <libnetfilter_queue/libnetfilter_queue_ipv6.h>
|
||||
#include <libnetfilter_queue/libnetfilter_queue_tcp.h>
|
||||
#include <libnetfilter_queue/pktbuff.h>
|
||||
|
||||
#define MAX_USER_AGENT_LENGTH (0xffff + (MNL_SOCKET_BUFFER_SIZE / 2))
|
||||
static char *replacement_user_agent_string = NULL;
|
||||
@ -56,43 +56,19 @@ void init_handler() {
|
||||
syslog(LOG_INFO, "Handler initialized.");
|
||||
}
|
||||
|
||||
// should free the ret value
|
||||
static char *ip_to_str(const ip_address_t *ip, const uint16_t port, const int ip_version) {
|
||||
ASSERT(ip_version == IPV4 || ip_version == IPV6);
|
||||
char *ip_buf = malloc(MAX_ADDR_PORT_LENGTH);
|
||||
memset(ip_buf, 0, MAX_ADDR_PORT_LENGTH);
|
||||
const char *retval = NULL;
|
||||
|
||||
if (ip_version == IPV4) {
|
||||
retval = inet_ntop(AF_INET, &ip->in4, ip_buf, INET_ADDRSTRLEN);
|
||||
} else {
|
||||
retval = inet_ntop(AF_INET6, &ip->in6, ip_buf, INET6_ADDRSTRLEN);
|
||||
}
|
||||
ASSERT(retval != NULL);
|
||||
|
||||
char port_buf[7];
|
||||
sprintf(port_buf, ":%d", port);
|
||||
strcat(ip_buf, port_buf);
|
||||
|
||||
return ip_buf;
|
||||
}
|
||||
|
||||
struct mark_op {
|
||||
bool should_set;
|
||||
uint32_t mark;
|
||||
};
|
||||
|
||||
static void send_verdict(
|
||||
const struct nf_queue *queue,
|
||||
const struct nf_packet *pkt,
|
||||
const struct mark_op mark,
|
||||
struct pkt_buff *mangled_pkt_buff) {
|
||||
static void send_verdict(const struct nf_queue *queue, const struct nf_packet *pkt, const struct mark_op mark,
|
||||
struct pkt_buff *mangled_pkt_buff) {
|
||||
struct nlmsghdr *nlh = nfqueue_put_header(pkt->queue_num, NFQNL_MSG_VERDICT);
|
||||
if (nlh == NULL) {
|
||||
syslog(LOG_ERR, "failed to put nfqueue header");
|
||||
goto end;
|
||||
}
|
||||
nfq_nlmsg_verdict_put(nlh, pkt->packet_id, NF_ACCEPT);
|
||||
nfq_nlmsg_verdict_put(nlh, (int)pkt->packet_id, NF_ACCEPT);
|
||||
|
||||
if (mark.should_set) {
|
||||
struct nlattr *nest = mnl_attr_nest_start_check(nlh, SEND_BUF_LEN, NFQA_CT);
|
||||
@ -116,7 +92,7 @@ static void send_verdict(
|
||||
syslog(LOG_ERR, "failed to send verdict: %s", strerror(errno));
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
if (nlh != NULL) {
|
||||
free(nlh);
|
||||
}
|
||||
@ -126,54 +102,59 @@ static bool conntrack_info_available = true;
|
||||
static bool cache_initialized = false;
|
||||
|
||||
static void add_to_cache(const struct nf_packet *pkt) {
|
||||
char *ip_str = ip_to_str(&pkt->orig.dst, pkt->orig.dst_port, pkt->orig.ip_version);
|
||||
cache_add(ip_str);
|
||||
free(ip_str);
|
||||
struct addr_port target = {
|
||||
.addr = pkt->orig.dst,
|
||||
.port = pkt->orig.dst_port,
|
||||
};
|
||||
|
||||
cache_add(target);
|
||||
}
|
||||
|
||||
static struct mark_op get_next_mark(const struct nf_packet *pkt, const bool has_ua) {
|
||||
if (!conntrack_info_available) {
|
||||
return (struct mark_op) {false, 0};
|
||||
return (struct mark_op){false, 0};
|
||||
}
|
||||
|
||||
// I didn't think this will happen, but just in case
|
||||
// firewall should already have a rule to return all marked with CONNMARK_NOT_HTTP packets
|
||||
if (pkt->conn_mark == CONNMARK_NOT_HTTP) {
|
||||
syslog(LOG_WARNING, "Packet has already been marked as not http. Maybe firewall rules are wrong?");
|
||||
return (struct mark_op) {false, 0};
|
||||
return (struct mark_op){false, 0};
|
||||
}
|
||||
|
||||
if (pkt->conn_mark == CONNMARK_HTTP) {
|
||||
return (struct mark_op) {false, 0};
|
||||
return (struct mark_op){false, 0};
|
||||
}
|
||||
|
||||
if (has_ua) {
|
||||
return (struct mark_op) {true, CONNMARK_HTTP};
|
||||
return (struct mark_op){true, CONNMARK_HTTP};
|
||||
}
|
||||
|
||||
if (!pkt->has_connmark || pkt->conn_mark == 0) {
|
||||
return (struct mark_op) {true, CONNMARK_ESTIMATE_LOWER};
|
||||
return (struct mark_op){true, CONNMARK_ESTIMATE_LOWER};
|
||||
}
|
||||
|
||||
if (pkt->conn_mark == CONNMARK_ESTIMATE_VERDICT) {
|
||||
add_to_cache(pkt);
|
||||
return (struct mark_op) {true, CONNMARK_NOT_HTTP};
|
||||
return (struct mark_op){true, CONNMARK_NOT_HTTP};
|
||||
}
|
||||
|
||||
if (pkt->conn_mark >= CONNMARK_ESTIMATE_LOWER && pkt->conn_mark <= CONNMARK_ESTIMATE_UPPER) {
|
||||
return (struct mark_op) {true, pkt->conn_mark + 1};
|
||||
return (struct mark_op){true, pkt->conn_mark + 1};
|
||||
}
|
||||
|
||||
syslog(LOG_WARNING, "Unexpected connmark value: %d, Maybe other program has changed connmark?", pkt->conn_mark);
|
||||
return (struct mark_op) {true, pkt->conn_mark + 1};
|
||||
return (struct mark_op){true, pkt->conn_mark + 1};
|
||||
}
|
||||
|
||||
bool should_ignore(const struct nf_packet *pkt) {
|
||||
bool retval = false;
|
||||
struct addr_port target = {
|
||||
.addr = pkt->orig.dst,
|
||||
.port = pkt->orig.dst_port,
|
||||
};
|
||||
|
||||
char *ip_str = ip_to_str(&pkt->orig.dst, pkt->orig.dst_port, pkt->orig.ip_version);
|
||||
retval = cache_contains(ip_str);
|
||||
free(ip_str);
|
||||
retval = cache_contains(target);
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -186,7 +167,7 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
|
||||
syslog(LOG_WARNING, "Note that this may lead to performance degradation. Especially on low-end routers.");
|
||||
} else {
|
||||
if (!cache_initialized) {
|
||||
init_not_http_cache();
|
||||
init_not_http_cache(60);
|
||||
cache_initialized = true;
|
||||
}
|
||||
}
|
||||
@ -194,7 +175,7 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
|
||||
|
||||
struct pkt_buff *pkt_buff = NULL;
|
||||
if (conntrack_info_available && should_ignore(pkt)) {
|
||||
send_verdict(queue, pkt, (struct mark_op) {true, CONNMARK_NOT_HTTP}, NULL);
|
||||
send_verdict(queue, pkt, (struct mark_op){true, CONNMARK_NOT_HTTP}, NULL);
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -238,7 +219,7 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
|
||||
const __auto_type tcp_hdr = nfq_tcp_get_hdr(pkt_buff);
|
||||
if (tcp_hdr == NULL) {
|
||||
// This packet is not tcp, pass it
|
||||
send_verdict(queue, pkt, (struct mark_op) {false, 0}, NULL);
|
||||
send_verdict(queue, pkt, (struct mark_op){false, 0}, NULL);
|
||||
syslog(LOG_WARNING, "Received non-tcp packet. You may set wrong firewall rules.");
|
||||
goto end;
|
||||
}
|
||||
@ -259,13 +240,13 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
// FIXME: can lead to false positive,
|
||||
// should also get CTA_COUNTERS_ORIG to check if this packet is a initial tcp packet
|
||||
// FIXME: can lead to false positive,
|
||||
// should also get CTA_COUNTERS_ORIG to check if this packet is a initial tcp packet
|
||||
|
||||
// if (!is_http_protocol(tcp_payload, tcp_payload_len)) {
|
||||
// send_verdict(queue, pkt, get_next_mark(pkt, false), NULL);
|
||||
// goto end;
|
||||
// }
|
||||
// if (!is_http_protocol(tcp_payload, tcp_payload_len)) {
|
||||
// send_verdict(queue, pkt, get_next_mark(pkt, false), NULL);
|
||||
// goto end;
|
||||
// }
|
||||
count_http_packet();
|
||||
|
||||
const void *search_start = tcp_payload;
|
||||
@ -288,7 +269,7 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
|
||||
void *ua_start = ua_pos + USER_AGENT_MATCH_LENGTH;
|
||||
|
||||
// for non-standard user-agent like User-Agent:XXX with no space after colon
|
||||
if (*(char *) ua_start == ' ') {
|
||||
if (*(char *)ua_start == ' ') {
|
||||
ua_start++;
|
||||
}
|
||||
|
||||
@ -318,7 +299,7 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
|
||||
|
||||
send_verdict(queue, pkt, get_next_mark(pkt, has_ua), pkt_buff);
|
||||
|
||||
end:
|
||||
end:
|
||||
free(pkt->payload);
|
||||
if (pkt_buff != NULL) {
|
||||
pktb_free(pkt_buff);
|
||||
|
@ -7,4 +7,4 @@ void init_handler();
|
||||
|
||||
void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt);
|
||||
|
||||
#endif //UA2F_HANDLER_H
|
||||
#endif // UA2F_HANDLER_H
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "statistics.h"
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <syslog.h>
|
||||
#include "statistics.h"
|
||||
#include <time.h>
|
||||
|
||||
static long long user_agent_packet_count = 0;
|
||||
static long long http_packet_count = 0;
|
||||
@ -19,30 +19,20 @@ void init_statistics() {
|
||||
syslog(LOG_INFO, "Statistics initialized.");
|
||||
}
|
||||
|
||||
void count_user_agent_packet() {
|
||||
user_agent_packet_count++;
|
||||
}
|
||||
void count_user_agent_packet() { user_agent_packet_count++; }
|
||||
|
||||
void count_tcp_packet() {
|
||||
tcp_packet_count++;
|
||||
}
|
||||
void count_tcp_packet() { tcp_packet_count++; }
|
||||
|
||||
void count_http_packet() {
|
||||
http_packet_count++;
|
||||
}
|
||||
void count_http_packet() { http_packet_count++; }
|
||||
|
||||
void count_ipv4_packet() {
|
||||
ipv4_packet_count++;
|
||||
}
|
||||
void count_ipv4_packet() { ipv4_packet_count++; }
|
||||
|
||||
void count_ipv6_packet() {
|
||||
ipv6_packet_count++;
|
||||
}
|
||||
void count_ipv6_packet() { ipv6_packet_count++; }
|
||||
|
||||
static char time_string_buffer[100];
|
||||
|
||||
char *fill_time_string(const double sec) {
|
||||
const int s = (int) sec;
|
||||
const int s = (int)sec;
|
||||
memset(time_string_buffer, 0, sizeof(time_string_buffer));
|
||||
if (s <= 60) {
|
||||
sprintf(time_string_buffer, "%d seconds", s);
|
||||
@ -52,8 +42,7 @@ char *fill_time_string(const double sec) {
|
||||
sprintf(time_string_buffer, "%d hours, %d minutes and %d seconds", s / 3600, s % 3600 / 60, s % 60);
|
||||
} else {
|
||||
sprintf(time_string_buffer, "%d days, %d hours, %d minutes and %d seconds", s / 86400, s % 86400 / 3600,
|
||||
s % 3600 / 60,
|
||||
s % 60);
|
||||
s % 3600 / 60, s % 60);
|
||||
}
|
||||
return time_string_buffer;
|
||||
}
|
||||
@ -62,17 +51,8 @@ void try_print_statistics() {
|
||||
if (user_agent_packet_count / last_report_count == 2 || user_agent_packet_count - last_report_count >= 8192) {
|
||||
last_report_count = user_agent_packet_count;
|
||||
const time_t current_t = time(NULL);
|
||||
syslog(
|
||||
LOG_INFO,
|
||||
"UA2F has handled %lld ua http, %lld http, %lld tcp. %lld ipv4, %lld ipv6 packets in %s.",
|
||||
user_agent_packet_count,
|
||||
http_packet_count,
|
||||
tcp_packet_count,
|
||||
ipv4_packet_count,
|
||||
ipv6_packet_count,
|
||||
fill_time_string(difftime(current_t, start_t))
|
||||
);
|
||||
syslog(LOG_INFO, "UA2F has handled %lld ua http, %lld http, %lld tcp. %lld ipv4, %lld ipv6 packets in %s.",
|
||||
user_agent_packet_count, http_packet_count, tcp_packet_count, ipv4_packet_count, ipv6_packet_count,
|
||||
fill_time_string(difftime(current_t, start_t)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
#include "statistics.h"
|
||||
#include "handler.h"
|
||||
#include "util.h"
|
||||
#include "cli.h"
|
||||
#include "handler.h"
|
||||
#include "statistics.h"
|
||||
#include "third/nfqueue-mnl.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef UA2F_ENABLE_UCI
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <signal.h>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma ide diagnostic ignored "EndlessLoop"
|
||||
@ -65,4 +65,4 @@ int main(const int argc, char *argv[]) {
|
||||
nfqueue_close(queue);
|
||||
}
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
#pragma clang diagnostic pop
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
void *memncasemem(const void *l, size_t l_len, const void *s, const size_t s_len) {
|
||||
register char *cur, *last;
|
||||
@ -18,15 +18,15 @@ void *memncasemem(const void *l, size_t l_len, const void *s, const size_t s_len
|
||||
|
||||
/* special case where s_len == 1 */
|
||||
if (s_len == 1) {
|
||||
for (cur = (char *) cl; l_len--; cur++)
|
||||
for (cur = (char *)cl; l_len--; cur++)
|
||||
if (tolower(cur[0]) == tolower(cs[0]))
|
||||
return cur;
|
||||
}
|
||||
|
||||
/* the last position where its possible to find "s" in "l" */
|
||||
last = (char *) cl + l_len - s_len;
|
||||
last = (char *)cl + l_len - s_len;
|
||||
|
||||
for (cur = (char *) cl; cur <= last; cur++)
|
||||
for (cur = (char *)cl; cur <= last; cur++)
|
||||
if (tolower(cur[0]) == tolower(cs[0])) {
|
||||
if (strncasecmp(cur, cs, s_len) == 0) {
|
||||
return cur;
|
||||
@ -47,7 +47,9 @@ static bool probe_http_method(const char *p, const int len, const char *opt) {
|
||||
bool is_http_protocol(const char *p, const unsigned int len) {
|
||||
bool pass = false;
|
||||
|
||||
#define PROBE_HTTP_METHOD(opt) if ((pass = probe_http_method(p, len, opt)) != false) return pass
|
||||
#define PROBE_HTTP_METHOD(opt) \
|
||||
if ((pass = probe_http_method(p, len, opt)) != false) \
|
||||
return pass
|
||||
|
||||
PROBE_HTTP_METHOD("GET");
|
||||
PROBE_HTTP_METHOD("POST");
|
||||
@ -60,4 +62,4 @@ bool is_http_protocol(const char *p, const unsigned int len) {
|
||||
|
||||
#undef PROBE_HTTP_METHOD
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef UA2F_UTIL_H
|
||||
#define UA2F_UTIL_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#define QUEUE_NUM 10010
|
||||
|
||||
void *memncasemem(const void *l, size_t l_len, const void *s, size_t s_len);
|
||||
bool is_http_protocol(const char *p, unsigned int len);
|
||||
|
||||
#endif //UA2F_UTIL_H
|
||||
#endif // UA2F_UTIL_H
|
||||
|
49
UA2F/test/cache_test.cc
Normal file
49
UA2F/test/cache_test.cc
Normal file
@ -0,0 +1,49 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
extern "C" {
|
||||
#include <cache.h>
|
||||
}
|
||||
|
||||
class CacheTest : public ::testing::Test {
|
||||
protected:
|
||||
struct addr_port test_addr{};
|
||||
|
||||
void SetUp() override {
|
||||
test_addr.addr.ip4 = 12345;
|
||||
test_addr.port = 80;
|
||||
init_not_http_cache(2);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
pthread_rwlock_wrlock(&cacheLock);
|
||||
// Clear the cache after each test
|
||||
struct cache *cur, *tmp;
|
||||
HASH_ITER(hh, not_http_dst_cache, cur, tmp) {
|
||||
HASH_DEL(not_http_dst_cache, cur);
|
||||
free(cur);
|
||||
}
|
||||
pthread_rwlock_unlock(&cacheLock);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(CacheTest, CacheInitiallyEmpty) {
|
||||
EXPECT_FALSE(cache_contains(test_addr));
|
||||
}
|
||||
|
||||
TEST_F(CacheTest, AddToCache) {
|
||||
cache_add(test_addr);
|
||||
EXPECT_TRUE(cache_contains(test_addr));
|
||||
}
|
||||
|
||||
TEST_F(CacheTest, AddAndRemoveFromCache) {
|
||||
cache_add(test_addr);
|
||||
EXPECT_TRUE(cache_contains(test_addr));
|
||||
sleep(5);
|
||||
EXPECT_FALSE(cache_contains(test_addr));
|
||||
}
|
||||
|
||||
TEST_F(CacheTest, CacheDoesNotContainNonexistentEntry) {
|
||||
struct addr_port nonexistent_addr{};
|
||||
nonexistent_addr.addr.ip4 = 54321;
|
||||
EXPECT_FALSE(cache_contains(nonexistent_addr));
|
||||
}
|
@ -7,29 +7,34 @@ PKG_VERSION:=2024.05.12
|
||||
PKG_RELEASE:=1
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
PKG_ARCH:=chinadns-ng@aarch64-linux-musl@generic+v8a@fast+lto
|
||||
PKG_HASH:=5d09aab8dbea99935b864b8f2c569e95a4e7c23aad8f0b19860b145dc917106f
|
||||
ifeq ($(BOARD),rockchip)
|
||||
PKG_ARCH:=chinadns-ng+wolfssl@aarch64-linux-musl@generic+v8a@fast+lto
|
||||
PKG_HASH:=d907398d08a2cadd8ab5b3c6c353de572bddb87db1363a458703dd7e966ddb13
|
||||
else
|
||||
PKG_ARCH:=chinadns-ng+wolfssl_noasm@aarch64-linux-musl@generic+v8a@fast+lto
|
||||
PKG_HASH:=80435ead00ed10b0122d999ef654c44c5be2eb58a270c2d7634244d6db0d9127
|
||||
endif
|
||||
else ifeq ($(ARCH),arm)
|
||||
ARM_CPU_FEATURES:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE))))
|
||||
ifeq ($(ARM_CPU_FEATURES),)
|
||||
PKG_ARCH:=chinadns-ng@arm-linux-musleabi@generic+v6+soft_float@fast+lto
|
||||
PKG_HASH:=34c80e973ce2b59185ad6771a280afd35b82941d08f072f46b620cf993b7eb94
|
||||
PKG_ARCH:=chinadns-ng+wolfssl@arm-linux-musleabi@generic+v6+soft_float@fast+lto
|
||||
PKG_HASH:=4f97d84065203f0e62815b2b0319818ac767698adad8ddc56a7974de08749e71
|
||||
else
|
||||
PKG_ARCH:=chinadns-ng@arm-linux-musleabihf@generic+v7a@fast+lto
|
||||
PKG_HASH:=ceee46ac45c4f3228c22a0a56e623132a5ad5631f0ce6a2ea0d3a4002fa4480f
|
||||
PKG_ARCH:=chinadns-ng+wolfssl@arm-linux-musleabihf@generic+v7a@fast+lto
|
||||
PKG_HASH:=86115b25ce082099c720169cbdee348dc8bbef3433f6a6580487ae6cc7fffd01
|
||||
endif
|
||||
else ifeq ($(ARCH),mips)
|
||||
PKG_ARCH:=chinadns-ng@mips-linux-musl@mips32+soft_float@fast+lto
|
||||
PKG_HASH:=8f13c199ca9b91106de2b1739dcc4decf0078f32e1c141deb02fe009659bd78e
|
||||
PKG_ARCH:=chinadns-ng+wolfssl@mips-linux-musl@mips32+soft_float@fast+lto
|
||||
PKG_HASH:=9f2f95eaf74ee5fc00e750f512563f8db00e7181c0dbef86d98dfaa1ff5ee2c4
|
||||
else ifeq ($(ARCH),mipsel)
|
||||
PKG_ARCH:=chinadns-ng@mipsel-linux-musl@mips32+soft_float@fast+lto
|
||||
PKG_HASH:=f43940ee1691ca1edc7cb0e142e74087dc99ed260c79556a96e98846c66b63b7
|
||||
PKG_ARCH:=chinadns-ng+wolfssl@mipsel-linux-musl@mips32+soft_float@fast+lto
|
||||
PKG_HASH:=aefe6a4e0aeffb74a568fe84d0a01ef033b1a702fff31ea97427538ad0e5a8f4
|
||||
else ifeq ($(ARCH),i386)
|
||||
PKG_ARCH:=chinadns-ng@i386-linux-musl@i686@fast+lto
|
||||
PKG_HASH:=a9af39f0a8781a596fd221e8e8285cc8d880865deb1cdd353274c7ac2df9865f
|
||||
PKG_ARCH:=chinadns-ng+wolfssl@i386-linux-musl@i686@fast+lto
|
||||
PKG_HASH:=a80335eaf98f04c4cf433bcfddd5a66ec03e6084accdfb3e35f02df1c5626ea9
|
||||
else ifeq ($(ARCH),x86_64)
|
||||
PKG_ARCH:=chinadns-ng@x86_64-linux-musl@x86_64@fast+lto
|
||||
PKG_HASH:=323e5aebba9d894e9f4f9adecad078092a4a54b8bb91f5468216386430f6c120
|
||||
PKG_ARCH:=chinadns-ng+wolfssl@x86_64-linux-musl@x86_64@fast+lto
|
||||
PKG_HASH:=a32e16b69760aaf3b2ef463229f0668ea5ac58bd87408f7aac05ddb8e52915c5
|
||||
else
|
||||
PKG_HASH:=dummy
|
||||
endif
|
||||
@ -50,7 +55,7 @@ define Package/chinadns-ng
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=ChinaDNS next generation, refactoring with epoll and ipset.
|
||||
URL:=https://github.com/zfl9/chinadns-ng
|
||||
DEPENDS:=@(aarch64||arm||i386||mips||mipsel||x86_64) @!(TARGET_x86_geode||TARGET_x86_legacy) +ipset
|
||||
DEPENDS:=@(aarch64||arm||i386||mips||mipsel||x86_64) +ipset
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
@ -1,147 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2021 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sagernet-core
|
||||
BASE_VERSION:=5.0.17
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/SagerNet/v2ray-core.git
|
||||
PKG_SOURCE_DATE:=2022-07-30
|
||||
PKG_SOURCE_VERSION:=26e36b1cb46f387cacd65c1a5900be592913f842
|
||||
PKG_MIRROR_HASH:=f8968ef7df8775f28c30f8115e2ce2e9324b1753526af6c89631edf1b1f56f8d
|
||||
PKG_VERSION:=$(BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION))
|
||||
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_FLAGS:=no-mips16
|
||||
|
||||
GO_PKG:=github.com/v2fly/v2ray-core/v5
|
||||
GO_PKG_BUILD_PKG:=$(GO_PKG)/main
|
||||
GO_PKG_LDFLAGS_X:= \
|
||||
$(GO_PKG).build=OpenWrt \
|
||||
$(GO_PKG).version=$(BASE_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
|
||||
|
||||
define Package/sagernet/template
|
||||
TITLE:=An enhanced v2ray edition for SagerNet
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
URL:=https://sagernet.org
|
||||
endef
|
||||
|
||||
define Package/sagernet-core
|
||||
$(call Package/sagernet/template)
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle
|
||||
CONFLICTS:=v2ray-core xray-core
|
||||
endef
|
||||
|
||||
define Package/sagernet-example
|
||||
$(call Package/sagernet/template)
|
||||
TITLE+= (example configs)
|
||||
DEPENDS:=sagernet-core
|
||||
CONFLICTS:=v2ray-example
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/sagernet-extra
|
||||
$(call Package/sagernet/template)
|
||||
TITLE+= (extra resources)
|
||||
DEPENDS:=sagernet-core
|
||||
CONFLICTS:=v2ray-extra
|
||||
PKGARCH:=all
|
||||
endef
|
||||
|
||||
define Package/sagernet/description
|
||||
Project V is a set of network tools that help you to build your own computer network.
|
||||
It secures your network connections and thus protects your privacy.
|
||||
endef
|
||||
|
||||
define Package/sagernet-core/description
|
||||
$(call Package/sagernet/description)
|
||||
|
||||
This is a v2ray-core fork for SagerNet.
|
||||
endef
|
||||
|
||||
define Package/sagernet-example/description
|
||||
$(call Package/sagernet/description)
|
||||
|
||||
This includes example configuration files for sagernet-core.
|
||||
endef
|
||||
|
||||
define Package/sagernet-extra/description
|
||||
$(call Package/sagernet/description)
|
||||
|
||||
This includes extra resources for sagernet-core.
|
||||
endef
|
||||
|
||||
define Package/sagernet-core/conffiles
|
||||
/etc/config/v2ray
|
||||
/etc/v2ray/
|
||||
endef
|
||||
|
||||
LIBCORE_NAME:=LibSagerNetCore
|
||||
LIBCORE_DATE:=2022-06-10
|
||||
LIBCORE_VERSION:=9ef7ab1de7604ab959222d4de8ab6152a402e432
|
||||
LIBCORE_FILE:=$(LIBCORE_NAME)-$(LIBCORE_DATE)-$(call version_abbrev,$(LIBCORE_VERSION)).tar.xz
|
||||
define Download/libcore
|
||||
PROTO:=git
|
||||
URL:=https://github.com/SagerNet/LibSagerNetCore.git
|
||||
VERSION:=$(LIBCORE_VERSION)
|
||||
FILE:=$(LIBCORE_FILE)
|
||||
SUBDIR:=$(LIBCORE_NAME)
|
||||
MIRROR_HASH:=9420189c45d5fbe682acee1da0b8f727cc5ea8c847ceeff5b026cd71ce60cf0f
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
|
||||
xzcat $(DL_DIR)/$(LIBCORE_FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
|
||||
$(CP) $(PKG_BUILD_DIR)/$(LIBCORE_NAME)/{obfs,ssr}.go \
|
||||
$(PKG_BUILD_DIR)/proxy/shadowsocks/plugin/self/
|
||||
$(SED) '/plugin\/self/d' -e 's/self.ParsePluginOptions/ParsePluginOptions/g' \
|
||||
$(PKG_BUILD_DIR)/proxy/shadowsocks/plugin/self/obfs.go
|
||||
$(SED) 's/package libcore/package self/g' \
|
||||
$(PKG_BUILD_DIR)/proxy/shadowsocks/plugin/self/{obfs,ssr}.go
|
||||
endef
|
||||
|
||||
define Package/sagernet-core/install
|
||||
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/main $(1)/usr/bin/v2ray
|
||||
$(LN) v2ray $(1)/usr/bin/xray
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/v2ray/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/release/config/config.json $(1)/etc/v2ray/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/config/
|
||||
$(INSTALL_CONF) $(CURDIR)/files/v2ray.conf $(1)/etc/config/v2ray
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(CURDIR)/files/v2ray.init $(1)/etc/init.d/v2ray
|
||||
endef
|
||||
|
||||
define Package/sagernet-example/install
|
||||
$(INSTALL_DIR) $(1)/etc/v2ray/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/release/config/vpoint_socks_vmess.json $(1)/etc/v2ray/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/release/config/vpoint_vmess_freedom.json $(1)/etc/v2ray/
|
||||
endef
|
||||
|
||||
define Package/sagernet-extra/install
|
||||
$(INSTALL_DIR) $(1)/usr/share/v2ray/
|
||||
$(CP) $(PKG_BUILD_DIR)/release/extra/* $(1)/usr/share/v2ray/
|
||||
endef
|
||||
|
||||
$(eval $(call Download,libcore))
|
||||
$(eval $(call BuildPackage,sagernet-core))
|
||||
$(eval $(call BuildPackage,sagernet-example))
|
||||
$(eval $(call BuildPackage,sagernet-extra))
|
@ -1,11 +0,0 @@
|
||||
|
||||
config v2ray 'enabled'
|
||||
option enabled '0'
|
||||
|
||||
config v2ray 'config'
|
||||
option confdir '/etc/v2ray'
|
||||
list conffiles '/etc/v2ray/config.json'
|
||||
option datadir '/usr/share/v2ray'
|
||||
option format 'json'
|
||||
option memconservative '1'
|
||||
|
@ -1,57 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
|
||||
CONF="v2ray"
|
||||
PROG="/usr/bin/v2ray"
|
||||
|
||||
start_service() {
|
||||
config_load "$CONF"
|
||||
|
||||
local enabled
|
||||
config_get_bool enabled "enabled" "enabled" "0"
|
||||
[ "$enabled" -eq "0" ] && exit 1
|
||||
|
||||
local confdir
|
||||
local conffiles
|
||||
local datadir
|
||||
local format
|
||||
|
||||
config_get confdir "config" "confdir"
|
||||
config_get conffiles "config" "conffiles"
|
||||
config_get datadir "config" "datadir" "/usr/share/v2ray"
|
||||
config_get format "config" "format" "json"
|
||||
config_get_bool memconservative "config" "memconservative" "1"
|
||||
|
||||
procd_open_instance "$CONF"
|
||||
procd_set_param command "$PROG" run
|
||||
[ -n "$confdir" ] && procd_append_param command -confdir "$confdir"
|
||||
[ -n "$conffiles" ] && {
|
||||
for i in $conffiles
|
||||
do
|
||||
procd_append_param command -config "$i"
|
||||
done
|
||||
}
|
||||
[ -n "$format" ] && procd_append_param command -format "$format"
|
||||
procd_set_param env v2ray.local.asset="$datadir"
|
||||
[ "$memconservative" -eq "1" ] && procd_append_param env V2RAY_CONF_GEOLOADER="memconservative"
|
||||
procd_set_param file $conffiles
|
||||
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param limits nofile="1000000 1000000"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param respawn
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
go get github.com/Dreamacro/clash/transport/ssr/protocol
|
||||
go get github.com/Dreamacro/clash/transport/ssr/obfs
|
||||
go get github.com/Dreamacro/clash/transport/simple-obfs
|
||||
---
|
||||
|
||||
--- a/go.mod
|
||||
+++ b/go.mod
|
||||
@@ -3,6 +3,7 @@ module github.com/v2fly/v2ray-core/v5
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
+ github.com/Dreamacro/clash v1.11.4
|
||||
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da
|
||||
github.com/dgryski/go-camellia v0.0.0-20191119043421-69a8a13fb23d
|
||||
github.com/dgryski/go-idea v0.0.0-20170306091226-d2fb45a411fb
|
||||
@@ -82,6 +83,7 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
||||
github.com/secure-io/siv-go v0.0.0-20180922214919-5ff40651e2c4 // indirect
|
||||
+ github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/xtaci/smux v1.5.16 // indirect
|
||||
go4.org/intern v0.0.0-20220301175310-a089fc204883 // indirect
|
||||
go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 // indirect
|
||||
--- a/go.sum
|
||||
+++ b/go.sum
|
||||
@@ -20,6 +20,8 @@ dmitri.shuralyov.com/state v0.0.0-201802
|
||||
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
+github.com/Dreamacro/clash v1.11.4 h1:ZQe/7G+JclA1vvyAn8MtaEBvQK73mWR6lV3BceDaJoY=
|
||||
+github.com/Dreamacro/clash v1.11.4/go.mod h1:ParIZ6P19q5GDgRE+HV/co7GunFRmvN31YFgNp4cwDw=
|
||||
github.com/FlowerWrong/water v0.0.0-20180301012659-01a4eaa1f6f2/go.mod h1:xrG5L7lq7T2DLnPr2frMnL906CNEoKRwLB+VYFhPq2w=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da h1:KjTM2ks9d14ZYCvmHS9iAKVt9AyzRSqNU1qabPih5BY=
|
||||
@@ -396,6 +398,8 @@ github.com/shurcooL/sanitized_anchor_nam
|
||||
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
|
||||
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
+github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
+github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
@@ -455,6 +459,7 @@ go.opentelemetry.io/proto/otlp v0.7.0/go
|
||||
go.starlark.net v0.0.0-20220714194419-4cadf0a12139 h1:zMemyQYZSyEdPaUFixYICrXf/0Rfnil7+jiQRf5IBZ0=
|
||||
go.starlark.net v0.0.0-20220714194419-4cadf0a12139/go.mod h1:t3mmBBPzAVvK0L0n1drDmrQsJ8FoIx4INCqVMTr/Zo0=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
+go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
|
||||
@@ -572,6 +577,7 @@ golang.org/x/sys v0.0.0-20190606165138-5
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
+golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=v2rayA
|
||||
PKG_VERSION:=2.2.5.1
|
||||
PKG_VERSION:=2.2.5.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/v2rayA/v2rayA/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=1935665d17e2bf2de7d3ca8a628e8c59d9ba934478a01080d68cdfe698481d3f
|
||||
PKG_HASH:=3d298b3e8d1803d691da943fe1cee1e4bf8f9444ed74cd4cf8b0968d0143aa64
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/service
|
||||
|
||||
PKG_LICENSE:=AGPL-3.0-only
|
||||
@ -60,7 +60,7 @@ define Download/v2raya-web
|
||||
URL:=https://github.com/v2rayA/v2rayA/releases/download/v$(PKG_VERSION)/
|
||||
URL_FILE:=web.tar.gz
|
||||
FILE:=$(WEB_FILE)
|
||||
HASH:=a45c4ee179e310ff8eb8935181a54b341347ae08e072323d69d637e3a0a3f6df
|
||||
HASH:=cf15c28c3d31c335a98cd4972041d38af415a875ae18b8676a69d519d5f4797a
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
|
Loading…
Reference in New Issue
Block a user