@@ -11,20 +11,18 @@ import (
1111)
1212
1313const (
14- inboundSessionKey ctx.SessionKey = 1
15- outboundSessionKey ctx.SessionKey = 2
16- contentSessionKey ctx.SessionKey = 3
17- isReverseMuxKey ctx.SessionKey = 4 // is reverse mux
18- sockoptSessionKey ctx.SessionKey = 5 // used by dokodemo to only receive sockopt.Mark
19- trackedConnectionErrorKey ctx.SessionKey = 6 // used by observer to get outbound error
20- dispatcherKey ctx.SessionKey = 7 // used by ss2022 inbounds to get dispatcher
21- timeoutOnlyKey ctx.SessionKey = 8 // mux context's child contexts to only cancel when its own traffic times out
22- allowedNetworkKey ctx.SessionKey = 9 // muxcool server control incoming request tcp/udp
23- fullHandlerKey ctx.SessionKey = 10 // outbound gets full handler
24- mitmAlpn11Key ctx.SessionKey = 11 // used by TLS dialer
25- mitmServerNameKey ctx.SessionKey = 12 // used by TLS dialer
26-
27- streamSettingsKey ctx.SessionKey = 13
14+ inboundSessionKey ctx.SessionKey = iota
15+ outboundSessionKey
16+ contentSessionKey
17+ isReverseMuxKey // is reverse mux
18+ sockoptSessionKey // used by dokodemo to only receive sockopt.Mark
19+ trackedConnectionErrorKey // used by observer to get outbound error
20+ dispatcherKey // used by ss2022 inbounds to get dispatcher
21+ allowedNetworkKey // muxcool server control incoming request tcp/udp
22+ fullHandlerKey // outbound gets full handler
23+ mitmAlpn11Key // used by TLS dialer
24+ mitmServerNameKey // used by TLS dialer
25+ streamSettingsKey
2826)
2927
3028func ContextWithInbound (ctx context.Context , inbound * Inbound ) context.Context {
@@ -137,17 +135,6 @@ func DispatcherFromContext(ctx context.Context) routing.Dispatcher {
137135 return nil
138136}
139137
140- func ContextWithTimeoutOnly (ctx context.Context , only bool ) context.Context {
141- return context .WithValue (ctx , timeoutOnlyKey , only )
142- }
143-
144- func TimeoutOnlyFromContext (ctx context.Context ) bool {
145- if val , ok := ctx .Value (timeoutOnlyKey ).(bool ); ok {
146- return val
147- }
148- return false
149- }
150-
151138func ContextWithAllowedNetwork (ctx context.Context , network net.Network ) context.Context {
152139 return context .WithValue (ctx , allowedNetworkKey , network )
153140}
0 commit comments