mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 17:46:58 -05:00
refine capability deisgn
This commit is contained in:
parent
2a90a46ed5
commit
7888c10622
@ -1,20 +1,16 @@
|
||||
package environment
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v5/features/extension/storage"
|
||||
)
|
||||
|
||||
type AppEnvironmentCapabilitySet interface {
|
||||
BaseEnvironmentCapabilitySet
|
||||
SystemNetworkCapabilitySet
|
||||
InstanceNetworkCapabilitySet
|
||||
FileSystemCapabilitySet
|
||||
PersistentStorage() storage.ScopedPersistentStorage
|
||||
TransientStorage() storage.ScopedTransientStorage
|
||||
PersistentStorageCapabilitySet
|
||||
TransientStorageCapabilitySet
|
||||
}
|
||||
|
||||
type AppEnvironment interface {
|
||||
AppEnvironmentCapabilitySet
|
||||
NarrowScope(key []byte) (AppEnvironment, error)
|
||||
NarrowScope(key string) (AppEnvironment, error)
|
||||
doNotImpl()
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package environment
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v5/common/environment/filesystemcap"
|
||||
"github.com/v2fly/v2ray-core/v5/common/log"
|
||||
"github.com/v2fly/v2ray-core/v5/features/extension/storage"
|
||||
"github.com/v2fly/v2ray-core/v5/transport/internet"
|
||||
"github.com/v2fly/v2ray-core/v5/transport/internet/tagged"
|
||||
)
|
||||
@ -37,3 +38,10 @@ type LogCapabilitySet interface {
|
||||
type FileSystemCapabilitySet interface {
|
||||
filesystemcap.FileSystemCapabilitySet
|
||||
}
|
||||
|
||||
type PersistentStorageCapabilitySet interface {
|
||||
PersistentStorage() storage.ScopedPersistentStorage
|
||||
}
|
||||
type TransientStorageCapabilitySet interface {
|
||||
TransientStorage() storage.ScopedTransientStorage
|
||||
}
|
||||
|
@ -2,10 +2,8 @@ package envctx
|
||||
|
||||
import "context"
|
||||
|
||||
type environmentContextKey int
|
||||
|
||||
const (
|
||||
environmentKey environmentContextKey = iota
|
||||
environmentKey string = "v2.environment"
|
||||
)
|
||||
|
||||
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
|
||||
|
@ -1,18 +1,14 @@
|
||||
package environment
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v5/features/extension/storage"
|
||||
)
|
||||
|
||||
type ProxyEnvironmentCapabilitySet interface {
|
||||
BaseEnvironmentCapabilitySet
|
||||
InstanceNetworkCapabilitySet
|
||||
TransientStorage() storage.ScopedTransientStorage
|
||||
TransientStorageCapabilitySet
|
||||
}
|
||||
|
||||
type ProxyEnvironment interface {
|
||||
ProxyEnvironmentCapabilitySet
|
||||
NarrowScope(key []byte) (ProxyEnvironment, error)
|
||||
NarrowScopeToTransport(key []byte) (TransportEnvironment, error)
|
||||
NarrowScope(key string) (ProxyEnvironment, error)
|
||||
NarrowScopeToTransport(key string) (TransportEnvironment, error)
|
||||
doNotImpl()
|
||||
}
|
||||
|
@ -1,18 +1,14 @@
|
||||
package environment
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v5/features/extension/storage"
|
||||
)
|
||||
|
||||
type TransportEnvironmentCapacitySet interface {
|
||||
BaseEnvironmentCapabilitySet
|
||||
SystemNetworkCapabilitySet
|
||||
InstanceNetworkCapabilitySet
|
||||
TransientStorage() storage.ScopedTransientStorage
|
||||
TransientStorageCapabilitySet
|
||||
}
|
||||
|
||||
type TransportEnvironment interface {
|
||||
TransportEnvironmentCapacitySet
|
||||
NarrowScope(key []byte) (TransportEnvironment, error)
|
||||
NarrowScope(key string) (TransportEnvironment, error)
|
||||
doNotImpl()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user