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:
@@ -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,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user