Skip to content

Commit

Permalink
test(config): fix tests for remove repeater
Browse files Browse the repository at this point in the history
Signed-off-by: black-desk <[email protected]>
  • Loading branch information
black-desk committed Jun 17, 2023
1 parent c695bc1 commit b5f1681
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 84 deletions.
2 changes: 0 additions & 2 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ var _ = Describe("Configuration", func() {
Expect(err).To(MatchErr(expectErr))
})
},
ContextTableEntry("../../test/data/too_few_ports.yaml", ErrTooFewPorts).
WithFmt("../../test/data/too_few_ports.yaml"),
ContextTableEntry("../../test/data/wrong_type.yaml", new(yaml.TypeError)).
WithFmt("../../test/data/wrong_type.yaml"),
ContextTableEntry("../../test/data/validation_fail.yaml", validator.ValidationErrors{}).
Expand Down
2 changes: 0 additions & 2 deletions internal/config/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ import (
)

var (
ErrTooFewPorts = errors.New("Too few ports for tproxy")
ErrTooFewMarks = errors.New("Too few marks for tproxy")
ErrCannotFoundCgroupv2Mount = errors.New("`cgroup2` mount point not found in /proc/mounts.")
)
26 changes: 10 additions & 16 deletions test/data/example_config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
version: 1
cgroup-root: AUTO
marks: '[100,300)'
route-table: 300

tproxies:
clash:
port: 7893
addr: 127.0.0.1

proxies:
proxy1:
udp: true
port: 1080
protocol: socks
addr: 127.0.0.1
mark: 4000
clash-meta:
port: 8893
mark: 4001
v2ray:
port: 12345
mark: 4002

rules:
- match: /user.slice/user-1000.slice/[email protected]/app.slice/*
tproxy: clash
- match: /user.slice/user-1001.slice/[email protected]/app.slice/*
proxy: proxy1
tproxy: clash-meta
- match: /user.slice/user-1002.slice/[email protected]/app.slice/*
proxy: proxy1

repeater:
listens:
- 127.0.0.1
tproxy-ports: "[13030,13040)"
tproxy: v2ray
28 changes: 0 additions & 28 deletions test/data/too_few_ports.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions test/data/validation_fail.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
version: 1
cgroup-root: AUTO
marks: '[100,300)'

tproxies:
clash:
port: 7893
addr: 127.0.0.1

proxies:
proxy1:
udp: true
port: 1080
protocol: socks
addr: 127.0.0.1

rules:
- match: /user.slice/user-1000.slice/[email protected]/app.slice/*
tproxy: clash
- match: /user.slice/user-1001.slice/[email protected]/app.slice/*
proxy: proxy1
- match: /user.slice/user-1002.slice/[email protected]/app.slice/*
proxy: proxy1

repeater:
listens:
- 127.0.0
tproxy-ports: "[13030,13040)"
29 changes: 10 additions & 19 deletions test/data/wrong_type.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
version: 1
cgroup-root: AUTO
marks: '[100,300)'
route-table: 300

proxies:
- socks1:
udp: true
port: 1080
protocol: socks
addr: 127.0.0.1
- socks2:
udp: true
port: 1081
protocol: socks
addr: 127.0.0.1
tproxies:
- tproxy1:
port: 7893
mark: 4000
- tproxy2:
port: 8893
mark: 4001

rules:
- match: /user.slice/user-1000.slice/[email protected]/app.slice/*
proxy: socks1
tproxy: socks1
- match: /user.slice/user-1001.slice/[email protected]/app.slice/*
drop: true
- match: /user.slice/user-1002.slice/[email protected]/app.slice/*
proxy: socks2

repeater:
listens:
- 127.0.0.1
tproxy-ports: "[13030,13031)"
tproxy: socks2

0 comments on commit b5f1681

Please sign in to comment.