1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-03 15:55:20 -05:00

merge user info inbound metadata

This commit is contained in:
Darien Raymond
2018-10-15 08:36:50 +02:00
parent e35e3e6e53
commit 595f3d685e
8 changed files with 42 additions and 26 deletions

View File

@@ -27,6 +27,10 @@ func withOutbound(outbound *session.Outbound) context.Context {
return session.ContextWithOutbound(context.Background(), outbound)
}
func withInbound(inbound *session.Inbound) context.Context {
return session.ContextWithInbound(context.Background(), inbound)
}
func TestRoutingRule(t *testing.T) {
assert := With(t)
@@ -131,11 +135,11 @@ func TestRoutingRule(t *testing.T) {
},
test: []ruleTest{
{
input: protocol.ContextWithUser(context.Background(), &protocol.MemoryUser{Email: "admin@v2ray.com"}),
input: withInbound(&session.Inbound{User: &protocol.MemoryUser{Email: "admin@v2ray.com"}}),
output: true,
},
{
input: protocol.ContextWithUser(context.Background(), &protocol.MemoryUser{Email: "love@v2ray.com"}),
input: withInbound(&session.Inbound{User: &protocol.MemoryUser{Email: "love@v2ray.com"}}),
output: false,
},
{