tlssupport

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHostRandom

func CreateHostRandom(
	hostSeq int,
	ip string,
	seeds map[peer.ID]ma.Multiaddr,
	logger api.Logger) (host.Host, peer.ID, ma.Multiaddr, error)

CreateHostRandom create a host instance with random crypto. This method only for testing.

func CreateHostWithCrypto

func CreateHostWithCrypto(
	hostSeq int,
	ip string,
	privateKey crypto.PrivateKey,
	seeds map[peer.ID]ma.Multiaddr,
	logger api.Logger) (host.Host, peer.ID, ma.Multiaddr, error)

CreateHostWithCrypto create a host instance with quic network type and simple config. This method only for testing.

func CreateHostWithCryptoPort added in v1.3.0

func CreateHostWithCryptoPort(
	port int,
	hostSeq int,
	ip string,
	privateKey crypto.PrivateKey,
	seeds map[peer.ID]ma.Multiaddr,
	logger api.Logger) (host.Host, peer.ID, ma.Multiaddr, error)

CreateHostWithCryptoPort create a host instance with quic network type and simple config. This method only for testing.

func MakeTlsConfigAndLoadPeerIdFuncWithPrivateKey

func MakeTlsConfigAndLoadPeerIdFuncWithPrivateKey(
	privateKey crypto.PrivateKey) (*cmTls.Config, types.LoadPeerIdFromCMTlsCertFunc, error)

MakeTlsConfigAndLoadPeerIdFuncWithPrivateKey create a tls config and load peer id function for the host config with private key given.

func PeerIdFunction

func PeerIdFunction() func(certificates []*cmx509.Certificate) (peer.ID, error)

PeerIdFunction is a function can load peer.ID from certificates got when tls handshaking. tcp server need this function to get remote peer pid

func PrivateKeyToCertificate

func PrivateKeyToCertificate(privateKey crypto.PrivateKey) (*cmTls.Certificate, error)

PrivateKeyToCertificate create a certificate simply with a private key.

func UseGMTls

func UseGMTls(tlsCertBytes []byte) (bool, error)

UseGMTls return true if it is a tls certificate with GM crypto.

Types

This section is empty.

Jump to

Keyboard shortcuts

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