Documentation
¶
Index ¶
- Variables
- func CreateDERPMeshTLSConfig(hostname string, tlsCertificates []tls.Certificate) (*tls.Config, error)
- func DERPPingPeerReplica(ctx context.Context, client http.Client, relayAddress string) error
- type Manager
- func (m *Manager) AllPrimary() []database.Replica
- func (m *Manager) Close() error
- func (m *Manager) DERPReplicasInRegion(regionID int32) []database.Replica
- func (m *Manager) DERPReplicasThisRegion() []database.Replica
- func (m *Manager) FetchNATSPeers() []string
- func (m *Manager) ID() uuid.UUID
- func (m *Manager) PublishUpdate() error
- func (m *Manager) Self() database.Replica
- func (m *Manager) SetCallback(name string, callback func())
- func (m *Manager) SetSelfNATSPort(port int32)
- func (m *Manager) UpdateNow(ctx context.Context) error
- type Options
Constants ¶
This section is empty.
Variables ¶
var PubsubEvent = "replica"
Functions ¶
func CreateDERPMeshTLSConfig ¶ added in v2.8.5
func CreateDERPMeshTLSConfig(hostname string, tlsCertificates []tls.Certificate) (*tls.Config, error)
CreateDERPMeshTLSConfig creates a TLS configuration for connecting to peers in the DERP mesh over private networking. It overrides the ServerName to be the expected public hostname of the peer, and trusts all of the TLS server certificates used by this replica (as we expect all replicas to use the same TLS certificates).
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager keeps the replica up to date and in sync with other replicas.
func New ¶
func New(ctx context.Context, logger slog.Logger, db database.Store, ps pubsub.Pubsub, options *Options) (*Manager, error)
New registers the replica with the database and periodically updates to ensure it's healthy. It contacts all other alive replicas to ensure they are reachable.
func (*Manager) AllPrimary ¶
AllPrimary returns every primary replica (not workspace proxy replicas), including itself.
func (*Manager) DERPReplicasInRegion ¶ added in v2.36.0
DERPReplicasInRegion returns every replica in the given DERP region excluding itself.
func (*Manager) DERPReplicasThisRegion ¶ added in v2.36.0
DERPReplicasThisRegion returns all replicas in the same region excluding itself.
func (*Manager) FetchNATSPeers ¶ added in v2.35.0
func (*Manager) PublishUpdate ¶
PublishUpdate notifies all other replicas to update.
func (*Manager) SetCallback ¶
SetCallback sets a named function to execute whenever new peers are refreshed or updated. Calling SetCallback again with the same name replaces the prior callback. Passing nil removes the named callback.