mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-22 21:25:01 +07:00
chore/docs: use CO-RE and refine README
This commit is contained in:
parent
cceeb53db7
commit
3480cbf921
@ -8,6 +8,15 @@ In order to improve the traffic split performance as much as possible, dae runs
|
||||
|
||||
As a successor of [v2rayA](https://github.com/v2rayA/v2rayA), dae abandoned v2ray-core to meet the needs of users more freely.
|
||||
|
||||
**Features**
|
||||
|
||||
1. `Real direct` traffic split implementation (need ipforward on).
|
||||
1. Split traffic by process name in local host.
|
||||
1. Split traffic by MAC address in LAN.
|
||||
1. Split traffic with invert match rules.
|
||||
1. Automatically switch nodes according to policy.
|
||||
1. Support full-cone NAT for shadowsocks, vmess, and trojan(-go).
|
||||
|
||||
## Usage
|
||||
|
||||
### Build
|
||||
|
@ -14,7 +14,7 @@
|
||||
// #include <bpf/bpf_core_read.h>
|
||||
#include "headers/bpf_endian.h"
|
||||
#include "headers/bpf_helpers.h"
|
||||
#include "headers/bpf_probe_read.h"
|
||||
#include "headers/bpf_core_read.h"
|
||||
|
||||
// #define __DEBUG_ROUTING
|
||||
// #define __PRINT_ROUTING_RESULT
|
||||
@ -1902,8 +1902,8 @@ static int __always_inline update_map_elem_by_cookie(const __u64 cookie) {
|
||||
__builtin_memset(&val, 0, sizeof(struct pid_pname));
|
||||
char buf[MAX_ARG_SCANNER_BUFFER_SIZE] = {0};
|
||||
struct task_struct *current = (void *)bpf_get_current_task();
|
||||
unsigned long arg_start = BPF_PROBE_READ_KERNEL(current, mm, arg_start);
|
||||
unsigned long arg_end = BPF_PROBE_READ_KERNEL(current, mm, arg_end);
|
||||
unsigned long arg_start = BPF_CORE_READ(current, mm, arg_start);
|
||||
unsigned long arg_end = BPF_CORE_READ(current, mm, arg_end);
|
||||
unsigned long arg_len = arg_end - arg_start;
|
||||
if (arg_len > MAX_ARG_LEN_TO_PROBE) {
|
||||
arg_len = MAX_ARG_LEN_TO_PROBE;
|
||||
@ -1932,8 +1932,7 @@ static int __always_inline update_map_elem_by_cookie(const __u64 cookie) {
|
||||
} else {
|
||||
buf[to_read] = 0;
|
||||
}
|
||||
// No need to CO-RE.
|
||||
if ((ret = bpf_probe_read_user(&buf, to_read,
|
||||
if ((ret = bpf_core_read_user(&buf, to_read,
|
||||
(const void *)(arg_start + j)))) {
|
||||
bpf_printk("failed to read process name: %d", ret);
|
||||
return ret;
|
||||
@ -1950,12 +1949,12 @@ static int __always_inline update_map_elem_by_cookie(const __u64 cookie) {
|
||||
if (length_cpy > TASK_COMM_LEN) {
|
||||
length_cpy = TASK_COMM_LEN;
|
||||
}
|
||||
if ((ret = bpf_probe_read_user(&val.pname, length_cpy,
|
||||
if ((ret = bpf_core_read_user(&val.pname, length_cpy,
|
||||
(const void *)(arg_start + last_slash)))) {
|
||||
bpf_printk("failed to read process name: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
bpf_probe_read_kernel(&val.pid, sizeof(val.pid), ¤t->tgid);
|
||||
bpf_core_read(&val.pid, sizeof(val.pid), ¤t->tgid);
|
||||
// bpf_printk("a start_end: %lu %lu", arg_start, arg_end);
|
||||
// bpf_printk("b start_end: %lu %lu", arg_start + last_slash, arg_start + j);
|
||||
|
||||
|
@ -47,11 +47,11 @@ group {
|
||||
# Randomly select a node from the group for every connection.
|
||||
# policy: random
|
||||
|
||||
# Select the node with min last latency from the group for every connection.
|
||||
# policy: min
|
||||
|
||||
# Select the first node from the group for every connection.
|
||||
policy: fixed(0)
|
||||
# policy: fixed(0)
|
||||
|
||||
# Select the node with min last latency from the group for every connection.
|
||||
policy: min
|
||||
}
|
||||
|
||||
group2 {
|
||||
|
Loading…
Reference in New Issue
Block a user