MCPcopy Create free account
hub / github.com/XTLS/REALITY / Config

Struct Config

common.go:550–907  ·  view source on GitHub ↗

A Config structure is used to configure a TLS client or server. After one has been passed to a TLS function it must not be modified. A Config may be reused; the tls package will also not modify it.

Source from the content-addressed store, hash-verified

548// modified. A Config may be reused; the tls package will also not
549// modify it.
550type Config struct {
551 DialContext func(ctx context.Context, network, address string) (net.Conn, error)
552
553 Show bool
554 Type string
555 Dest string
556 Xver byte
557
558 ServerNames map[string]bool
559 PrivateKey []byte
560 MinClientVer []byte
561 MaxClientVer []byte
562 MaxTimeDiff time.Duration
563 ShortIds map[[8]byte]bool
564
565 Mldsa65Key []byte
566
567 LimitFallbackUpload LimitFallback
568 LimitFallbackDownload LimitFallback
569
570 // Rand provides the source of entropy for nonces and RSA blinding.
571 // If Rand is nil, TLS uses the cryptographic random reader in package
572 // crypto/rand.
573 // The Reader must be safe for use by multiple goroutines.
574 Rand io.Reader
575
576 // Time returns the current time as the number of seconds since the epoch.
577 // If Time is nil, TLS uses time.Now.
578 Time func() time.Time
579
580 // Certificates contains one or more certificate chains to present to the
581 // other side of the connection. The first certificate compatible with the
582 // peer's requirements is selected automatically.
583 //
584 // Server configurations must set one of Certificates, GetCertificate or
585 // GetConfigForClient. Clients doing client-authentication may set either
586 // Certificates or GetClientCertificate.
587 //
588 // Note: if there are multiple Certificates, and they don't have the
589 // optional field Leaf set, certificate selection will incur a significant
590 // per-handshake performance cost.
591 Certificates []Certificate
592
593 // NameToCertificate maps from a certificate name to an element of
594 // Certificates. Note that a certificate name can be of the form
595 // '*.example.com' and so doesn't have to be a domain name as such.
596 //
597 // Deprecated: NameToCertificate only allows associating a single
598 // certificate with a given name. Leave this field nil to let the library
599 // select the first compatible chain from Certificates.
600 NameToCertificate map[string]*Certificate
601
602 // GetCertificate returns a Certificate based on the given
603 // ClientHelloInfo. It will only be called if the client supplies SNI
604 // information or if Certificates is empty.
605 //
606 // If GetCertificate is nil or returns nil, then the certificate is
607 // retrieved from NameToCertificate. If NameToCertificate is nil, the

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected