v2ray-core: github.com/v2ray/v2ray-core/app/policy Index | Files

package policy

import "github.com/v2ray/v2ray-core/app/policy"

Package policy is an implementation of policy.Manager feature.

Index

Package Files

config.go config.pb.go errors.generated.go manager.go policy.go

Variables

var File_app_policy_config_proto protoreflect.FileDescriptor

type Config Uses

type Config struct {
    Level  map[uint32]*Policy `protobuf:"bytes,1,rep,name=level,proto3" json:"level,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
    System *SystemPolicy      `protobuf:"bytes,2,opt,name=system,proto3" json:"system,omitempty"`
    // contains filtered or unexported fields
}

func (*Config) Descriptor Uses

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetLevel Uses

func (x *Config) GetLevel() map[uint32]*Policy

func (*Config) GetSystem Uses

func (x *Config) GetSystem() *SystemPolicy

func (*Config) ProtoMessage Uses

func (*Config) ProtoMessage()

func (*Config) ProtoReflect Uses

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset Uses

func (x *Config) Reset()

func (*Config) String Uses

func (x *Config) String() string

type Instance Uses

type Instance struct {
    // contains filtered or unexported fields
}

Instance is an instance of Policy manager.

func New Uses

func New(ctx context.Context, config *Config) (*Instance, error)

New creates new Policy manager instance.

func (*Instance) Close Uses

func (m *Instance) Close() error

Close implements common.Closable.Close().

func (*Instance) ForLevel Uses

func (m *Instance) ForLevel(level uint32) policy.Session

ForLevel implements policy.Manager.

func (*Instance) ForSystem Uses

func (m *Instance) ForSystem() policy.System

ForSystem implements policy.Manager.

func (*Instance) Start Uses

func (m *Instance) Start() error

Start implements common.Runnable.Start().

func (*Instance) Type Uses

func (*Instance) Type() interface{}

Type implements common.HasType.

type Policy Uses

type Policy struct {
    Timeout *Policy_Timeout `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"`
    Stats   *Policy_Stats   `protobuf:"bytes,2,opt,name=stats,proto3" json:"stats,omitempty"`
    Buffer  *Policy_Buffer  `protobuf:"bytes,3,opt,name=buffer,proto3" json:"buffer,omitempty"`
    // contains filtered or unexported fields
}

func (*Policy) Descriptor Uses

func (*Policy) Descriptor() ([]byte, []int)

Deprecated: Use Policy.ProtoReflect.Descriptor instead.

func (*Policy) GetBuffer Uses

func (x *Policy) GetBuffer() *Policy_Buffer

func (*Policy) GetStats Uses

func (x *Policy) GetStats() *Policy_Stats

func (*Policy) GetTimeout Uses

func (x *Policy) GetTimeout() *Policy_Timeout

func (*Policy) ProtoMessage Uses

func (*Policy) ProtoMessage()

func (*Policy) ProtoReflect Uses

func (x *Policy) ProtoReflect() protoreflect.Message

func (*Policy) Reset Uses

func (x *Policy) Reset()

func (*Policy) String Uses

func (x *Policy) String() string

func (*Policy) ToCorePolicy Uses

func (p *Policy) ToCorePolicy() policy.Session

ToCorePolicy converts this Policy to policy.Session.

type Policy_Buffer Uses

type Policy_Buffer struct {

    // Buffer size per connection, in bytes. -1 for unlimited buffer.
    Connection int32 `protobuf:"varint,1,opt,name=connection,proto3" json:"connection,omitempty"`
    // contains filtered or unexported fields
}

func (*Policy_Buffer) Descriptor Uses

func (*Policy_Buffer) Descriptor() ([]byte, []int)

Deprecated: Use Policy_Buffer.ProtoReflect.Descriptor instead.

func (*Policy_Buffer) GetConnection Uses

func (x *Policy_Buffer) GetConnection() int32

func (*Policy_Buffer) ProtoMessage Uses

func (*Policy_Buffer) ProtoMessage()

func (*Policy_Buffer) ProtoReflect Uses

func (x *Policy_Buffer) ProtoReflect() protoreflect.Message

func (*Policy_Buffer) Reset Uses

func (x *Policy_Buffer) Reset()

func (*Policy_Buffer) String Uses

func (x *Policy_Buffer) String() string

type Policy_Stats Uses

type Policy_Stats struct {
    UserUplink   bool `protobuf:"varint,1,opt,name=user_uplink,json=userUplink,proto3" json:"user_uplink,omitempty"`
    UserDownlink bool `protobuf:"varint,2,opt,name=user_downlink,json=userDownlink,proto3" json:"user_downlink,omitempty"`
    // contains filtered or unexported fields
}

func (*Policy_Stats) Descriptor Uses

func (*Policy_Stats) Descriptor() ([]byte, []int)

Deprecated: Use Policy_Stats.ProtoReflect.Descriptor instead.

func (x *Policy_Stats) GetUserDownlink() bool
func (x *Policy_Stats) GetUserUplink() bool

func (*Policy_Stats) ProtoMessage Uses

func (*Policy_Stats) ProtoMessage()

func (*Policy_Stats) ProtoReflect Uses

func (x *Policy_Stats) ProtoReflect() protoreflect.Message

func (*Policy_Stats) Reset Uses

func (x *Policy_Stats) Reset()

func (*Policy_Stats) String Uses

func (x *Policy_Stats) String() string

type Policy_Timeout Uses

type Policy_Timeout struct {
    Handshake      *Second `protobuf:"bytes,1,opt,name=handshake,proto3" json:"handshake,omitempty"`
    ConnectionIdle *Second `protobuf:"bytes,2,opt,name=connection_idle,json=connectionIdle,proto3" json:"connection_idle,omitempty"`
    UplinkOnly     *Second `protobuf:"bytes,3,opt,name=uplink_only,json=uplinkOnly,proto3" json:"uplink_only,omitempty"`
    DownlinkOnly   *Second `protobuf:"bytes,4,opt,name=downlink_only,json=downlinkOnly,proto3" json:"downlink_only,omitempty"`
    // contains filtered or unexported fields
}

Timeout is a message for timeout settings in various stages, in seconds.

func (*Policy_Timeout) Descriptor Uses

func (*Policy_Timeout) Descriptor() ([]byte, []int)

Deprecated: Use Policy_Timeout.ProtoReflect.Descriptor instead.

func (*Policy_Timeout) GetConnectionIdle Uses

func (x *Policy_Timeout) GetConnectionIdle() *Second

func (*Policy_Timeout) GetDownlinkOnly Uses

func (x *Policy_Timeout) GetDownlinkOnly() *Second

func (*Policy_Timeout) GetHandshake Uses

func (x *Policy_Timeout) GetHandshake() *Second

func (*Policy_Timeout) GetUplinkOnly Uses

func (x *Policy_Timeout) GetUplinkOnly() *Second

func (*Policy_Timeout) ProtoMessage Uses

func (*Policy_Timeout) ProtoMessage()

func (*Policy_Timeout) ProtoReflect Uses

func (x *Policy_Timeout) ProtoReflect() protoreflect.Message

func (*Policy_Timeout) Reset Uses

func (x *Policy_Timeout) Reset()

func (*Policy_Timeout) String Uses

func (x *Policy_Timeout) String() string

type Second Uses

type Second struct {
    Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
    // contains filtered or unexported fields
}

func (*Second) Descriptor Uses

func (*Second) Descriptor() ([]byte, []int)

Deprecated: Use Second.ProtoReflect.Descriptor instead.

func (*Second) Duration Uses

func (s *Second) Duration() time.Duration

Duration converts Second to time.Duration.

func (*Second) GetValue Uses

func (x *Second) GetValue() uint32

func (*Second) ProtoMessage Uses

func (*Second) ProtoMessage()

func (*Second) ProtoReflect Uses

func (x *Second) ProtoReflect() protoreflect.Message

func (*Second) Reset Uses

func (x *Second) Reset()

func (*Second) String Uses

func (x *Second) String() string

type SystemPolicy Uses

type SystemPolicy struct {
    Stats *SystemPolicy_Stats `protobuf:"bytes,1,opt,name=stats,proto3" json:"stats,omitempty"`
    // contains filtered or unexported fields
}

func (*SystemPolicy) Descriptor Uses

func (*SystemPolicy) Descriptor() ([]byte, []int)

Deprecated: Use SystemPolicy.ProtoReflect.Descriptor instead.

func (*SystemPolicy) GetStats Uses

func (x *SystemPolicy) GetStats() *SystemPolicy_Stats

func (*SystemPolicy) ProtoMessage Uses

func (*SystemPolicy) ProtoMessage()

func (*SystemPolicy) ProtoReflect Uses

func (x *SystemPolicy) ProtoReflect() protoreflect.Message

func (*SystemPolicy) Reset Uses

func (x *SystemPolicy) Reset()

func (*SystemPolicy) String Uses

func (x *SystemPolicy) String() string

func (*SystemPolicy) ToCorePolicy Uses

func (p *SystemPolicy) ToCorePolicy() policy.System

ToCorePolicy converts this SystemPolicy to policy.System.

type SystemPolicy_Stats Uses

type SystemPolicy_Stats struct {
    InboundUplink    bool `protobuf:"varint,1,opt,name=inbound_uplink,json=inboundUplink,proto3" json:"inbound_uplink,omitempty"`
    InboundDownlink  bool `protobuf:"varint,2,opt,name=inbound_downlink,json=inboundDownlink,proto3" json:"inbound_downlink,omitempty"`
    OutboundUplink   bool `protobuf:"varint,3,opt,name=outbound_uplink,json=outboundUplink,proto3" json:"outbound_uplink,omitempty"`
    OutboundDownlink bool `protobuf:"varint,4,opt,name=outbound_downlink,json=outboundDownlink,proto3" json:"outbound_downlink,omitempty"`
    // contains filtered or unexported fields
}

func (*SystemPolicy_Stats) Descriptor Uses

func (*SystemPolicy_Stats) Descriptor() ([]byte, []int)

Deprecated: Use SystemPolicy_Stats.ProtoReflect.Descriptor instead.

func (x *SystemPolicy_Stats) GetInboundDownlink() bool
func (x *SystemPolicy_Stats) GetInboundUplink() bool
func (x *SystemPolicy_Stats) GetOutboundDownlink() bool
func (x *SystemPolicy_Stats) GetOutboundUplink() bool

func (*SystemPolicy_Stats) ProtoMessage Uses

func (*SystemPolicy_Stats) ProtoMessage()

func (*SystemPolicy_Stats) ProtoReflect Uses

func (x *SystemPolicy_Stats) ProtoReflect() protoreflect.Message

func (*SystemPolicy_Stats) Reset Uses

func (x *SystemPolicy_Stats) Reset()

func (*SystemPolicy_Stats) String Uses

func (x *SystemPolicy_Stats) String() string

Package policy imports 10 packages (graph). Updated 2020-12-29. Refresh now. Tools for package owners.