Documentation ¶
Index ¶
- Constants
- Variables
- func AddHeaders(src []*v1.Header, dest http.Header)
- func ConvertConnectToProtoError(err *connect.Error) *v1.Error
- func ConvertErrorToConnectError(err error) *connect.Error
- func ConvertErrorToProtoError(err error) *v1.Error
- func ConvertProtoToConnectError(err *v1.Error) *connect.Error
- func ConvertToProtoHeader(src http.Header) []*v1.Header
- func NewClientCert() (certBytes []byte, keyBytes []byte, err error)
- func NewClientTLSConfig(caCert, clientCert, clientKey []byte) (*tls.Config, error)
- func NewCodec(json bool) codec
- func NewServerCert() (tls.Certificate, []byte, error)
- func NewServerTLSConfig(cert tls.Certificate, clientCertMode tls.ClientAuthType, clientCACert []byte) (*tls.Config, error)
- func ParseServerCert(cert, key []byte) (tls.Certificate, error)
- func ReadDelimitedMessage[T proto.Message](in io.Reader, msg T) error
- func WriteDelimitedMessage[T proto.Message](out io.Writer, msg T) error
- type StreamDecoder
- type StreamEncoder
- type TextConnectCodec
Constants ¶
const ( // DefaultHost is the default host to use for the server. DefaultHost = "127.0.0.1" // DefaultPort is the default port to use for the server. We choose 0 so that // an ephemeral port is selected by the OS if no port is specified. DefaultPort = 0 // The fully-qualified service name for the Conformance Service. ConformanceServiceName = conformancev1connect.ConformanceServiceName // The prefix for type URLs used in Any messages. DefaultAnyResolverPrefix = "type.googleapis.com/" )
const ( ClientCertName = "Conformance Client" ServerCertName = "Conformance Server" )
Variables ¶
var (
// Version is the version to report from all binaries.
Version = buildVersion + buildVersionSuffix
)
Functions ¶
func AddHeaders ¶
AddHeaders adds all header values in src to dest.
func ConvertConnectToProtoError ¶
ConvertConnectToProtoError converts the given Connect error to a proto Error message. If err is nil, the function will also return nil.
func ConvertErrorToConnectError ¶
ConvertErrorToConnectError converts the given error to a Connect error If err is nil, function will also return nil. If err is not of type connect.Error, a Connect error of code Unknown is returned.
func ConvertErrorToProtoError ¶
ConvertErrorToProtoError converts the given error to a proto Error If err is nil, function will also return nil. If err is not of type connect.Error, a code representing Unknown is returned.
func ConvertProtoToConnectError ¶
ConvertProtoToConnectError creates a Connect error from the given proto Error message.
func ConvertToProtoHeader ¶
ConvertToProtoHeader converts HTTP headers to a slice of proto Headers.
func NewClientCert ¶
NewClientCert is like NewServerCert, but it produces a certificate that is intended for client authentication. It also returns the encoded bytes of the private key.
func NewClientTLSConfig ¶
NewClientTLSConfig returns a TLS configuration for an RPC client that uses the given PEM-encoded certs/keys. The caCert parameter must not be empty, and is the server certificate to trust (or a CA cert for the issuer of the server cert). The clientCert and clientKey parameters are optional. If one is provided then both must be present. They enable the use of a client certificate during the TLS handshake, for mutually-authenticated TLS.
func NewServerCert ¶
func NewServerCert() (tls.Certificate, []byte, error)
NewServerCert generates a new self-signed certificate. The first return value is usable with a *tls.Config. The second value is the PEM-encoded certificate which must be shared with clients for them to trust the server. Both will be zero values if the returned error is not nil.
func NewServerTLSConfig ¶
func NewServerTLSConfig(cert tls.Certificate, clientCertMode tls.ClientAuthType, clientCACert []byte) (*tls.Config, error)
NewServerTLSConfig returns a TLS configuration for an RPC server that uses the given PEM-encoded cert/key. If the cert and key parameters are required. The clientCACert parameter is required unless clientCerts is tls.NoClientCert.
func ParseServerCert ¶
func ParseServerCert(cert, key []byte) (tls.Certificate, error)
ParseServerCert parses the given PEM-encoded cert and key.
func ReadDelimitedMessage ¶
ReadDelimitedMessage reads the next message from in. This first reads a fixed four byte preface, which is a network-encoded (i.e. big-endian) 32-bit integer that represents the message size. This then reads a number of bytes equal to that size and unmarshals it into msg.
Types ¶
type StreamDecoder ¶
StreamDecoder is used to decode messages from a stream. This is used when the input contains a sequence of messages, not just one.
type StreamEncoder ¶
StreamEncoder is used to encode messages to a stream. This is used when the output will contain a sequence of messages, not just one.
type TextConnectCodec ¶
type TextConnectCodec struct { prototext.MarshalOptions prototext.UnmarshalOptions }
TextConnectCodec implements the connect.Codec interface, providing the protobuf text format.
func (*TextConnectCodec) Name ¶
func (t *TextConnectCodec) Name() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
app
|
|
connectconformance/testsuites
Package testsuites contains embedded test suite data used when running conformance tests.
|
Package testsuites contains embedded test suite data used when running conformance tests. |
gen
|
|