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
|
package environment
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/v2fly/v2ray-core/v5/features/extension/storage"
|
|
||||||
)
|
|
||||||
|
|
||||||
type AppEnvironmentCapabilitySet interface {
|
type AppEnvironmentCapabilitySet interface {
|
||||||
BaseEnvironmentCapabilitySet
|
BaseEnvironmentCapabilitySet
|
||||||
SystemNetworkCapabilitySet
|
SystemNetworkCapabilitySet
|
||||||
InstanceNetworkCapabilitySet
|
InstanceNetworkCapabilitySet
|
||||||
FileSystemCapabilitySet
|
FileSystemCapabilitySet
|
||||||
PersistentStorage() storage.ScopedPersistentStorage
|
PersistentStorageCapabilitySet
|
||||||
TransientStorage() storage.ScopedTransientStorage
|
TransientStorageCapabilitySet
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppEnvironment interface {
|
type AppEnvironment interface {
|
||||||
AppEnvironmentCapabilitySet
|
AppEnvironmentCapabilitySet
|
||||||
NarrowScope(key []byte) (AppEnvironment, error)
|
NarrowScope(key string) (AppEnvironment, error)
|
||||||
doNotImpl()
|
doNotImpl()
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package environment
|
|||||||
import (
|
import (
|
||||||
"github.com/v2fly/v2ray-core/v5/common/environment/filesystemcap"
|
"github.com/v2fly/v2ray-core/v5/common/environment/filesystemcap"
|
||||||
"github.com/v2fly/v2ray-core/v5/common/log"
|
"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"
|
||||||
"github.com/v2fly/v2ray-core/v5/transport/internet/tagged"
|
"github.com/v2fly/v2ray-core/v5/transport/internet/tagged"
|
||||||
)
|
)
|
||||||
@ -37,3 +38,10 @@ type LogCapabilitySet interface {
|
|||||||
type FileSystemCapabilitySet interface {
|
type FileSystemCapabilitySet interface {
|
||||||
filesystemcap.FileSystemCapabilitySet
|
filesystemcap.FileSystemCapabilitySet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PersistentStorageCapabilitySet interface {
|
||||||
|
PersistentStorage() storage.ScopedPersistentStorage
|
||||||
|
}
|
||||||
|
type TransientStorageCapabilitySet interface {
|
||||||
|
TransientStorage() storage.ScopedTransientStorage
|
||||||
|
}
|
||||||
|
@ -2,10 +2,8 @@ package envctx
|
|||||||
|
|
||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
type environmentContextKey int
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
environmentKey environmentContextKey = iota
|
environmentKey string = "v2.environment"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
|
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
package environment
|
package environment
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/v2fly/v2ray-core/v5/features/extension/storage"
|
|
||||||
)
|
|
||||||
|
|
||||||
type ProxyEnvironmentCapabilitySet interface {
|
type ProxyEnvironmentCapabilitySet interface {
|
||||||
BaseEnvironmentCapabilitySet
|
BaseEnvironmentCapabilitySet
|
||||||
InstanceNetworkCapabilitySet
|
InstanceNetworkCapabilitySet
|
||||||
TransientStorage() storage.ScopedTransientStorage
|
TransientStorageCapabilitySet
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProxyEnvironment interface {
|
type ProxyEnvironment interface {
|
||||||
ProxyEnvironmentCapabilitySet
|
ProxyEnvironmentCapabilitySet
|
||||||
NarrowScope(key []byte) (ProxyEnvironment, error)
|
NarrowScope(key string) (ProxyEnvironment, error)
|
||||||
NarrowScopeToTransport(key []byte) (TransportEnvironment, error)
|
NarrowScopeToTransport(key string) (TransportEnvironment, error)
|
||||||
doNotImpl()
|
doNotImpl()
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
package environment
|
package environment
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/v2fly/v2ray-core/v5/features/extension/storage"
|
|
||||||
)
|
|
||||||
|
|
||||||
type TransportEnvironmentCapacitySet interface {
|
type TransportEnvironmentCapacitySet interface {
|
||||||
BaseEnvironmentCapabilitySet
|
BaseEnvironmentCapabilitySet
|
||||||
SystemNetworkCapabilitySet
|
SystemNetworkCapabilitySet
|
||||||
InstanceNetworkCapabilitySet
|
InstanceNetworkCapabilitySet
|
||||||
TransientStorage() storage.ScopedTransientStorage
|
TransientStorageCapabilitySet
|
||||||
}
|
}
|
||||||
|
|
||||||
type TransportEnvironment interface {
|
type TransportEnvironment interface {
|
||||||
TransportEnvironmentCapacitySet
|
TransportEnvironmentCapacitySet
|
||||||
NarrowScope(key []byte) (TransportEnvironment, error)
|
NarrowScope(key string) (TransportEnvironment, error)
|
||||||
doNotImpl()
|
doNotImpl()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user