p2ptls

package
v0.0.0-...-a6cdbf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package p2ptls

@author: xwc1125

Package p2ptls

@author: xwc1125

Package p2ptls

@author: xwc1125

Package p2ptls

@author: xwc1125

Index

Constants

View Source
const ProtocolID = "/tls/1.0.0"

ProtocolID 协ID

Variables

This section is empty.

Functions

This section is empty.

Types

type CaTrustRoot

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

CaTrustRoot CA可信根

func NewCaTrustRoot

func NewCaTrustRoot(caRoots [][]byte) (*CaTrustRoot, error)

NewCaTrustRoot 创建CA可信根

func (*CaTrustRoot) AddCert

func (r *CaTrustRoot) AddCert(root *x509.Certificate)

AddCert 添加CA证书

func (*CaTrustRoot) AppendCertsFromPEM

func (r *CaTrustRoot) AppendCertsFromPEM(rootPem []byte) bool

AppendCertsFromPEM 添加pem证书

func (*CaTrustRoot) RefreshCARootFromPem

func (r *CaTrustRoot) RefreshCARootFromPem(rootsPem [][]byte) bool

RefreshCARootFromPem 更新CA可信根

func (*CaTrustRoot) RootsPool

func (r *CaTrustRoot) RootsPool() *x509.CertPool

RootsPool 获取证书池

func (*CaTrustRoot) VerifyCert

func (r *CaTrustRoot) VerifyCert(cert *x509.Certificate) error

VerifyCert 验证证书

type Identity

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

func NewIdentity

func NewIdentity(cert *tls.Certificate, caRoots [][]byte) (*Identity, error)

func (*Identity) ConfigForAny

func (i *Identity) ConfigForAny() (*tls.Config, <-chan ci.PubKey)

func (*Identity) ConfigForPeer

func (i *Identity) ConfigForPeer(remote peer.ID) (*tls.Config, <-chan ci.PubKey)

func (*Identity) PubKeyFromCertChain

func (i *Identity) PubKeyFromCertChain(chain []*x509.Certificate) (ci.PubKey, error)

type Transport

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

Transport 安全通信会话

func New

func New(cert *tls.Certificate, caRoots [][]byte) (*Transport, error)

func (*Transport) SecureInbound

func (t *Transport) SecureInbound(ctx context.Context, insecure net.Conn) (sec.SecureConn, error)

SecureInbound runs the TLS handshake as a server.

func (*Transport) SecureOutbound

func (t *Transport) SecureOutbound(ctx context.Context, insecure net.Conn, p peer.ID) (sec.SecureConn, error)

SecureOutbound runs the TLS handshake as a client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL