This commit is contained in:
Darien Raymond
2017-12-14 15:02:36 +01:00
parent 6797483fe0
commit 484bdeecc9
4 changed files with 8 additions and 0 deletions
+2
View File
@@ -4,10 +4,12 @@ import (
"time"
)
// Duration converts Second to time.Duration.
func (s *Second) Duration() time.Duration {
return time.Second * time.Duration(s.Value)
}
// OverrideWith overrides current Policy with another one.
func (p *Policy) OverrideWith(another *Policy) {
if another.Timeout != nil {
if another.Timeout.Handshake != nil {
+2
View File
@@ -7,10 +7,12 @@ import (
"v2ray.com/core/common"
)
// Instance is an instance of Policy manager.
type Instance struct {
levels map[uint32]*policy.Policy
}
// New creates new Policy manager instance.
func New(ctx context.Context, config *policy.Config) (*Instance, error) {
levels := config.Level
if levels == nil {
+2
View File
@@ -8,12 +8,14 @@ import (
"v2ray.com/core/common/event"
)
// Application is a component that runs in Space.
type Application interface {
Interface() interface{}
Start() error
Close()
}
// CreateAppFromConfig creates an Application based on its config. Application must have been registered.
func CreateAppFromConfig(ctx context.Context, config interface{}) (Application, error) {
application, err := common.CreateObject(ctx, config)
if err != nil {