Skip to content

Commit ecfa1e7

Browse files
authored
Simplify memory for Agent and Auth services (#16)
* Simplify memory for Agent and Auth services * WIP metrics * Rework metrics * Fixes
1 parent 11fbd6a commit ecfa1e7

74 files changed

Lines changed: 1698 additions & 3972 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 23 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ config = "0.14"
2424
console-subscriber = {version = "0.4", optional = true}
2525
clickhouse = { version = "0.13.0" }
2626
clap = { version = "4.4", features = ["derive"] }
27+
dashmap = "6.1.0"
2728
defguard_wireguard_rs = {version = "0.7.2", features=["serde"]}
2829
default-net = "0.22"
2930
fern = "0.7"
@@ -59,6 +60,7 @@ qrcode = "0.14"
5960
x25519-dalek = { version = "2", features = ["static_secrets"] }
6061
warp = "0.3"
6162
zmq = "0.10"
63+
parking_lot = "0.12.5"
6264

6365
sha2 = "0.10"
6466
data-encoding = "2.5"

config-agent-example.toml

Lines changed: 29 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,38 @@
1-
[debug]
2-
# enabled = true
3-
# web_server = "127.0.0.1"
4-
# web_port = 3001
5-
6-
[carbon]
7-
# address = "localhost:2003"
8-
9-
[logging]
10-
# level = "debug"
11-
121
[agent]
13-
# local = false
14-
# metrics_enabled = true
15-
# metrics_interval = 60
16-
# stat_enabled = true
17-
# stat_job_interval = 60
2+
local = false
3+
snapshot_interval = 30
4+
snapshot_path = "snapshots/agent_snapshot.bin"
185

196
[xray]
20-
# xray_config_path = "dev/xray-config.json"
7+
enabled = true
8+
xray_config_path = "/etc/xray/config.json"
219

22-
[zmq]
23-
# sub_endpoint = "tcp://localhost:3000"
24-
# pub_endpoint = "tcp://*:3000"
25-
26-
[node]
27-
# env = "dev"
28-
# hostname = "<define in env or config>"
29-
# default_interface = "<autodetected>"
30-
# ipv4 = "<autodetected>"
31-
# uuid = "9658b391-01cb-4031-a3f5-6cbdd749bcff"
32-
# label = "🏴‍☠️🏴‍☠️🏴‍☠️ dev"
10+
[wg]
11+
enabled = true
12+
port = 51820
13+
interface = "wg0"
14+
# privkey и address обычно лучше через env, но можно и тут
3315

3416
[h2]
35-
#enabled = true
36-
#path = "path/to/h2.yaml"
17+
enabled = false
18+
path = "etc/frkn/h2.yaml"
3719

38-
[wg]
39-
#enabled = true
40-
#port = 51599
41-
#network= "10.10.0.0/16"
42-
#address = "10.10.0.1"
43-
#interface = "utun7"
44-
#privkey = "6KVWBZmCBNt1t5hI6KXXf4Eo4mlGNKAxETeRgcXNK0Q="
45-
#pubkey = "Yhg+gj8TqQ3/10a/Ae+Tv1iPin/HigmOnhRkMj7k/hw="
46-
#dns = ["1.1.1.1"]
20+
[mtproto]
21+
enabled = true
22+
port = 8443
23+
secret = "dd00112233445566778899aabbccddeeff"
24+
25+
[metrics]
26+
enabled = true
27+
publisher = "tcp://api-server-ip:5555"
28+
interval = 10
4729

4830
[api]
49-
# address = "127.0.0.1"
50-
# port = 3005
51-
# endpoint = "http://localhost:3005"
52-
# node_health_check_timeout = 60
53-
# user_limit_check_interval = 60
54-
# user_reactivate_interval = 60
55-
# token = "supetsecrettoken"
56-
# user_limit_mb = 1000
57-
# healthcheck_interval = 60
31+
endpoint = "https://api.frkn.org"
32+
token = "your-super-secret-api-token"
33+
34+
[logging]
35+
level = "warn"
36+
37+
[zmq]
38+
endpoint = "tcp://api-server-ip:3000"

config-api-example.toml

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,29 @@
11
[api]
2-
# address = "127.0.0.1"
3-
# port = 3005
4-
# endpoint = "http://localhost:3005"
5-
# node_health_check_timeout = 60
6-
# user_limit_check_interval = 60
7-
# user_reactivate_interval = 60
8-
# token = "supetsecrettoken"
9-
# user_limit_mb = 1000
10-
# healthcheck_interval = 60
11-
12-
[debug]
13-
# enabled = true
14-
# web_server = "127.0.0.1"
15-
# web_port = 3001
2+
address = "0.0.0.0"
3+
port = 3005
4+
token = "your-super-secret-api-token"
5+
metrics_enabled = true
6+
metrics_interval = 60
7+
db_sync_interval_sec = 300
8+
subscription_restore_interval = 60
9+
subscription_expire_interval = 60
10+
max_points = 100000000
11+
retention_seconds = 604800 # 7 days
1612

1713
[node]
18-
# env = "dev"
19-
# hostname = "<define in env or config>"
20-
# default_interface = "<autodetected>"
21-
# ipv4 = "<autodetected>"
22-
# uuid = "9658b391-01cb-4031-a3f5-6cbdd749bcff"
23-
# label = "🏴‍☠️🏴‍☠️🏴‍☠️ dev"
14+
env = "experimental"
15+
label = "🏴‍☠️ DarkMachine"
16+
max_bandwidth_bps = 1000000000 #1gbps
2417

2518
[logging]
26-
# level = "debug"
19+
level = "debug"
2720

2821
[zmq]
29-
# endpoint = "tcp://*:3000"
30-
31-
[clickhouse]
32-
# address = "http://localhost:8123"
22+
endpoint = "tcp://*:3000"
3323

3424
[pg]
35-
# host = "localhost"
36-
# port = 5432
37-
# db = "postgres"
38-
# username = "postgres"
39-
# password = "password"
25+
host = "localhost"
26+
port = 5432
27+
db = "frkn_db"
28+
username = "postgres"
29+
password = "password"

config-auth-eample.toml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1+
[auth]
2+
snapshot_interval = 30
3+
snapshot_path = "snapshots/auth_snapshot.bin"
4+
web_host = "https://auth.frkn.org"
5+
web_server = "0.0.0.0"
6+
web_port = 3005
7+
email_file = "users_trials.csv"
18

2-
[debug]
3-
#enable = true
4-
#web_server = "127.0.0.1"
5-
#web_port = 3445
9+
[api]
10+
endpoint = "http://localhost:3005"
11+
token = "your-super-secret-api-token"
612

13+
[smtp]
14+
server = "smtp.gmail.com"
15+
port = 587
16+
username = "notifications@frkn.org"
17+
password = "app-password-here"
18+
from = "FRKN Privacy <noreply@frkn.org>"
719

8-
[logging]
9-
#level = "debug"
10-
11-
[zmq]
12-
#endpoint = "tcp://localhost:4000"
13-
14-
[auth]
15-
#snapshot_path = "snapshots/snapshot.bin"
16-
17-
[node]
18-
#env = "dev"
19-
#hostname = "darkmachine-test"
20-
#uuid = "9557b391-01cb-4031-a3f5-6cbdd74fffff"
21-
22-
[api]
23-
#endpoint = "http://127.0.0.1:5005"
24-
#token = "token"
20+
[metrics]
21+
publisher = "tcp://127.0.0.1:5555"
22+
interval = 60
2523

24+
[logging]
25+
level = "info"
2626

27+
[zmq]
28+
endpoint = "tcp://localhost:3000"

0 commit comments

Comments
 (0)