7
7
C "github.com/sagernet/sing-box/constant"
8
8
"github.com/sagernet/sing-box/option"
9
9
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
10
+ "github.com/sagernet/sing/common"
11
+ "github.com/sagernet/sing/common/json/badoption"
10
12
11
13
"github.com/gofrs/uuid/v5"
12
14
)
@@ -15,22 +17,22 @@ func TestBrutalShadowsocks(t *testing.T) {
15
17
method := shadowaead_2022 .List [0 ]
16
18
password := mkBase64 (t , 16 )
17
19
startInstance (t , option.Options {
18
- Inbounds : []option.LegacyInbound {
20
+ Inbounds : []option.Inbound {
19
21
{
20
22
Type : C .TypeMixed ,
21
23
Tag : "mixed-in" ,
22
- MixedOptions : option.HTTPMixedInboundOptions {
24
+ Options : & option.HTTPMixedInboundOptions {
23
25
ListenOptions : option.ListenOptions {
24
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
26
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
25
27
ListenPort : clientPort ,
26
28
},
27
29
},
28
30
},
29
31
{
30
32
Type : C .TypeShadowsocks ,
31
- ShadowsocksOptions : option.ShadowsocksInboundOptions {
33
+ Options : & option.ShadowsocksInboundOptions {
32
34
ListenOptions : option.ListenOptions {
33
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
35
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
34
36
ListenPort : serverPort ,
35
37
},
36
38
Method : method ,
@@ -46,14 +48,14 @@ func TestBrutalShadowsocks(t *testing.T) {
46
48
},
47
49
},
48
50
},
49
- LegacyOutbounds : []option.LegacyOutbound {
51
+ Outbounds : []option.Outbound {
50
52
{
51
53
Type : C .TypeDirect ,
52
54
},
53
55
{
54
56
Type : C .TypeShadowsocks ,
55
57
Tag : "ss-out" ,
56
- ShadowsocksOptions : option.ShadowsocksOutboundOptions {
58
+ Options : & option.ShadowsocksOutboundOptions {
57
59
ServerOptions : option.ServerOptions {
58
60
Server : "127.0.0.1" ,
59
61
ServerPort : serverPort ,
@@ -100,22 +102,22 @@ func TestBrutalTrojan(t *testing.T) {
100
102
_ , certPem , keyPem := createSelfSignedCertificate (t , "example.org" )
101
103
password := mkBase64 (t , 16 )
102
104
startInstance (t , option.Options {
103
- Inbounds : []option.LegacyInbound {
105
+ Inbounds : []option.Inbound {
104
106
{
105
107
Type : C .TypeMixed ,
106
108
Tag : "mixed-in" ,
107
- MixedOptions : option.HTTPMixedInboundOptions {
109
+ Options : & option.HTTPMixedInboundOptions {
108
110
ListenOptions : option.ListenOptions {
109
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
111
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
110
112
ListenPort : clientPort ,
111
113
},
112
114
},
113
115
},
114
116
{
115
117
Type : C .TypeTrojan ,
116
- TrojanOptions : option.TrojanInboundOptions {
118
+ Options : & option.TrojanInboundOptions {
117
119
ListenOptions : option.ListenOptions {
118
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
120
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
119
121
ListenPort : serverPort ,
120
122
},
121
123
Users : []option.TrojanUser {{Password : password }},
@@ -138,14 +140,14 @@ func TestBrutalTrojan(t *testing.T) {
138
140
},
139
141
},
140
142
},
141
- LegacyOutbounds : []option.LegacyOutbound {
143
+ Outbounds : []option.Outbound {
142
144
{
143
145
Type : C .TypeDirect ,
144
146
},
145
147
{
146
148
Type : C .TypeTrojan ,
147
149
Tag : "ss-out" ,
148
- TrojanOptions : option.TrojanOutboundOptions {
150
+ Options : & option.TrojanOutboundOptions {
149
151
ServerOptions : option.ServerOptions {
150
152
Server : "127.0.0.1" ,
151
153
ServerPort : serverPort ,
@@ -197,22 +199,22 @@ func TestBrutalTrojan(t *testing.T) {
197
199
func TestBrutalVMess (t * testing.T ) {
198
200
user , _ := uuid .NewV4 ()
199
201
startInstance (t , option.Options {
200
- Inbounds : []option.LegacyInbound {
202
+ Inbounds : []option.Inbound {
201
203
{
202
204
Type : C .TypeMixed ,
203
205
Tag : "mixed-in" ,
204
- MixedOptions : option.HTTPMixedInboundOptions {
206
+ Options : & option.HTTPMixedInboundOptions {
205
207
ListenOptions : option.ListenOptions {
206
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
208
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
207
209
ListenPort : clientPort ,
208
210
},
209
211
},
210
212
},
211
213
{
212
214
Type : C .TypeVMess ,
213
- VMessOptions : option.VMessInboundOptions {
215
+ Options : & option.VMessInboundOptions {
214
216
ListenOptions : option.ListenOptions {
215
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
217
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
216
218
ListenPort : serverPort ,
217
219
},
218
220
Users : []option.VMessUser {{UUID : user .String ()}},
@@ -227,14 +229,14 @@ func TestBrutalVMess(t *testing.T) {
227
229
},
228
230
},
229
231
},
230
- LegacyOutbounds : []option.LegacyOutbound {
232
+ Outbounds : []option.Outbound {
231
233
{
232
234
Type : C .TypeDirect ,
233
235
},
234
236
{
235
237
Type : C .TypeVMess ,
236
238
Tag : "ss-out" ,
237
- VMessOptions : option.VMessOutboundOptions {
239
+ Options : & option.VMessOutboundOptions {
238
240
ServerOptions : option.ServerOptions {
239
241
Server : "127.0.0.1" ,
240
242
ServerPort : serverPort ,
@@ -279,22 +281,22 @@ func TestBrutalVMess(t *testing.T) {
279
281
func TestBrutalVLESS (t * testing.T ) {
280
282
user , _ := uuid .NewV4 ()
281
283
startInstance (t , option.Options {
282
- Inbounds : []option.LegacyInbound {
284
+ Inbounds : []option.Inbound {
283
285
{
284
286
Type : C .TypeMixed ,
285
287
Tag : "mixed-in" ,
286
- MixedOptions : option.HTTPMixedInboundOptions {
288
+ Options : & option.HTTPMixedInboundOptions {
287
289
ListenOptions : option.ListenOptions {
288
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
290
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
289
291
ListenPort : clientPort ,
290
292
},
291
293
},
292
294
},
293
295
{
294
296
Type : C .TypeVLESS ,
295
- VLESSOptions : option.VLESSInboundOptions {
297
+ Options : & option.VLESSInboundOptions {
296
298
ListenOptions : option.ListenOptions {
297
- Listen : option . NewListenAddress ( netip .IPv4Unspecified ()),
299
+ Listen : common . Ptr ( badoption . Addr ( netip .IPv4Unspecified () )),
298
300
ListenPort : serverPort ,
299
301
},
300
302
Users : []option.VLESSUser {{UUID : user .String ()}},
@@ -326,14 +328,14 @@ func TestBrutalVLESS(t *testing.T) {
326
328
},
327
329
},
328
330
},
329
- LegacyOutbounds : []option.LegacyOutbound {
331
+ Outbounds : []option.Outbound {
330
332
{
331
333
Type : C .TypeDirect ,
332
334
},
333
335
{
334
336
Type : C .TypeVLESS ,
335
337
Tag : "ss-out" ,
336
- VLESSOptions : option.VLESSOutboundOptions {
338
+ Options : & option.VLESSOutboundOptions {
337
339
ServerOptions : option.ServerOptions {
338
340
Server : "127.0.0.1" ,
339
341
ServerPort : serverPort ,
0 commit comments