Documentation ¶
Index ¶
- Constants
- func DefaultClientTLSConfig(publicKey crypto.PublicKey) (*tls.Config, error)
- func DefaultServerTLSConfig(cert *tls.Certificate) *tls.Config
- func IsServerAuthError(err error) bool
- func SecureGRPCDialOpt(publicKeyHex string) (grpc.DialOption, error)
- func X509Certificate(privKey crypto.PrivateKey, opts ...CertificateOption) (*tls.Certificate, error)
- type CertificateConfig
- type CertificateOption
- type ServerAuthError
Constants ¶
const DefaultMaxMsgSize = 1 << (10 * 3) // 1 GiB
DefaultMaxMsgSize use 1 GiB as the default message size limit. This enforces a sane max message size, while still allowing for reasonably large messages. grpc library default is 4 MiB.
const NoCompressor = ""
NoCompressor use when no specific compressor name provided, which effectively means no compression.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientTLSConfig ¶
DefaultClientTLSConfig returns the default TLS client config with the given public key for a secure GRPC client The TLSConfig verifies that the server certifcate is valid and has the correct signature
func DefaultServerTLSConfig ¶
func DefaultServerTLSConfig(cert *tls.Certificate) *tls.Config
DefaultServerTLSConfig returns the default TLS server config with the given cert for a secure GRPC server
func IsServerAuthError ¶
IsServerAuthError checks if the input error is of a ServerAuthError type
func SecureGRPCDialOpt ¶
func SecureGRPCDialOpt(publicKeyHex string) (grpc.DialOption, error)
SecureGRPCDialOpt creates a secure GRPC dial option with TLS config
func X509Certificate ¶
func X509Certificate(privKey crypto.PrivateKey, opts ...CertificateOption) (*tls.Certificate, error)
X509Certificate generates a self-signed x509 TLS certificate from the given key. The generated certificate includes a libp2p extension that specifies the public key and the signature. The certificate does not include any SAN extension.
Types ¶
type CertificateConfig ¶ added in v0.30.0
type CertificateConfig struct {
// contains filtered or unexported fields
}
CertificateConfig is used to configure an Certificate
type CertificateOption ¶ added in v0.30.0
type CertificateOption func(r *CertificateConfig)
CertificateOption transforms an CertificateConfig to apply optional settings.
func WithCertTemplate ¶ added in v0.30.0
func WithCertTemplate(template *x509.Certificate) CertificateOption
WithCertTemplate specifies the template to use when generating a new certificate.
type ServerAuthError ¶
type ServerAuthError struct {
// contains filtered or unexported fields
}
ServerAuthError is an error returned when the server authentication fails
func (ServerAuthError) Error ¶
func (e ServerAuthError) Error() string