core: v2ray.com/core/transport/internet/tls Index | Files

package tls

import "v2ray.com/core/transport/internet/tls"

Index

Package Files

config.go config.pb.go config_other.go errors.generated.go tls.go

Variables

var (
    Certificate_Usage_name = map[int32]string{
        0:  "ENCIPHERMENT",
        1:  "AUTHORITY_VERIFY",
        2:  "AUTHORITY_ISSUE",
    }
    Certificate_Usage_value = map[string]int32{
        "ENCIPHERMENT":     0,
        "AUTHORITY_VERIFY": 1,
        "AUTHORITY_ISSUE":  2,
    }
)

Enum value maps for Certificate_Usage.

var File_transport_internet_tls_config_proto protoreflect.FileDescriptor

func Client Uses

func Client(c net.Conn, config *tls.Config) net.Conn

Client initiates a TLS client handshake on the given connection.

func Server Uses

func Server(c net.Conn, config *tls.Config) net.Conn

Server initiates a TLS server handshake on the given connection.

type Certificate Uses

type Certificate struct {

    // TLS certificate in x509 format.
    Certificate []byte `protobuf:"bytes,1,opt,name=Certificate,proto3" json:"Certificate,omitempty"`
    // TLS key in x509 format.
    Key   []byte            `protobuf:"bytes,2,opt,name=Key,proto3" json:"Key,omitempty"`
    Usage Certificate_Usage `protobuf:"varint,3,opt,name=usage,proto3,enum=v2ray.core.transport.internet.tls.Certificate_Usage" json:"usage,omitempty"`
    // contains filtered or unexported fields
}

func ParseCertificate Uses

func ParseCertificate(c *cert.Certificate) *Certificate

ParseCertificate converts a cert.Certificate to Certificate.

func (*Certificate) Descriptor Uses

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

Deprecated: Use Certificate.ProtoReflect.Descriptor instead.

func (*Certificate) GetCertificate Uses

func (x *Certificate) GetCertificate() []byte

func (*Certificate) GetKey Uses

func (x *Certificate) GetKey() []byte

func (*Certificate) GetUsage Uses

func (x *Certificate) GetUsage() Certificate_Usage

func (*Certificate) ProtoMessage Uses

func (*Certificate) ProtoMessage()

func (*Certificate) ProtoReflect Uses

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

func (*Certificate) Reset Uses

func (x *Certificate) Reset()

func (*Certificate) String Uses

func (x *Certificate) String() string

type Certificate_Usage Uses

type Certificate_Usage int32
const (
    Certificate_ENCIPHERMENT     Certificate_Usage = 0
    Certificate_AUTHORITY_VERIFY Certificate_Usage = 1
    Certificate_AUTHORITY_ISSUE  Certificate_Usage = 2
)

func (Certificate_Usage) Descriptor Uses

func (Certificate_Usage) Descriptor() protoreflect.EnumDescriptor

func (Certificate_Usage) Enum Uses

func (x Certificate_Usage) Enum() *Certificate_Usage

func (Certificate_Usage) EnumDescriptor Uses

func (Certificate_Usage) EnumDescriptor() ([]byte, []int)

Deprecated: Use Certificate_Usage.Descriptor instead.

func (Certificate_Usage) Number Uses

func (x Certificate_Usage) Number() protoreflect.EnumNumber

func (Certificate_Usage) String Uses

func (x Certificate_Usage) String() string

func (Certificate_Usage) Type Uses

func (Certificate_Usage) Type() protoreflect.EnumType

type Config Uses

type Config struct {

    // Whether or not to allow self-signed certificates.
    AllowInsecure bool `protobuf:"varint,1,opt,name=allow_insecure,json=allowInsecure,proto3" json:"allow_insecure,omitempty"`
    // Whether or not to allow insecure cipher suites.
    AllowInsecureCiphers bool `protobuf:"varint,5,opt,name=allow_insecure_ciphers,json=allowInsecureCiphers,proto3" json:"allow_insecure_ciphers,omitempty"`
    // List of certificates to be served on server.
    Certificate []*Certificate `protobuf:"bytes,2,rep,name=certificate,proto3" json:"certificate,omitempty"`
    // Override server name.
    ServerName string `protobuf:"bytes,3,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"`
    // Lists of string as ALPN values.
    NextProtocol []string `protobuf:"bytes,4,rep,name=next_protocol,json=nextProtocol,proto3" json:"next_protocol,omitempty"`
    // Whether or not to disable session (ticket) resumption.
    DisableSessionResumption bool `protobuf:"varint,6,opt,name=disable_session_resumption,json=disableSessionResumption,proto3" json:"disable_session_resumption,omitempty"`
    // If true, root certificates on the system will not be loaded for
    // verification.
    DisableSystemRoot bool `protobuf:"varint,7,opt,name=disable_system_root,json=disableSystemRoot,proto3" json:"disable_system_root,omitempty"`
    // contains filtered or unexported fields
}

func ConfigFromStreamSettings Uses

func ConfigFromStreamSettings(settings *internet.MemoryStreamConfig) *Config

ConfigFromStreamSettings fetches Config from stream settings. Nil if not found.

func (*Config) BuildCertificates Uses

func (c *Config) BuildCertificates() []tls.Certificate

BuildCertificates builds a list of TLS certificates from proto definition.

func (*Config) Descriptor Uses

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

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetAllowInsecure Uses

func (x *Config) GetAllowInsecure() bool

func (*Config) GetAllowInsecureCiphers Uses

func (x *Config) GetAllowInsecureCiphers() bool

func (*Config) GetCertificate Uses

func (x *Config) GetCertificate() []*Certificate

func (*Config) GetDisableSessionResumption Uses

func (x *Config) GetDisableSessionResumption() bool

func (*Config) GetDisableSystemRoot Uses

func (x *Config) GetDisableSystemRoot() bool

func (*Config) GetNextProtocol Uses

func (x *Config) GetNextProtocol() []string

func (*Config) GetServerName Uses

func (x *Config) GetServerName() string

func (*Config) GetTLSConfig Uses

func (c *Config) GetTLSConfig(opts ...Option) *tls.Config

GetTLSConfig converts this Config into tls.Config.

func (*Config) IsExperiment8357 Uses

func (c *Config) IsExperiment8357() bool

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 Conn Uses

type Conn struct {
    *tls.Conn
}

func (*Conn) HandshakeAddress Uses

func (c *Conn) HandshakeAddress() net.Address

func (*Conn) WriteMultiBuffer Uses

func (c *Conn) WriteMultiBuffer(mb buf.MultiBuffer) error

type Option Uses

type Option func(*tls.Config)

Option for building TLS config.

func WithDestination Uses

func WithDestination(dest net.Destination) Option

WithDestination sets the server name in TLS config.

func WithNextProto Uses

func WithNextProto(protocol ...string) Option

WithNextProto sets the ALPN values in TLS config.

Package tls imports 14 packages (graph) and is imported by 98 packages. Updated 2020-10-15. Refresh now. Tools for package owners.