Documentation
¶
Overview ¶
Package gate implements the gate server component.
Index ¶
- type Gate
- type Option
- func WithAddr(addr string) Option
- func WithContext(ctx context.Context) Option
- func WithDispatch(dispatch cluster.Dispatch) Option
- func WithExpose(expose bool) Option
- func WithID(id string) Option
- func WithLinkerCallTimeout(callTimeout time.Duration) Option
- func WithLinkerCommandQueueSize(commandQueueSize int32) Option
- func WithLinkerCommandWriteTimeout(commandWriteTimeout time.Duration) Option
- func WithLinkerConnNum(connNum int) Option
- func WithLinkerDialRetryTimes(dialRetryTimes int) Option
- func WithLinkerDialTimeout(dialTimeout time.Duration) Option
- func WithLinkerFaultRecoveryTime(faultRecoveryTime time.Duration) Option
- func WithLocator(locator locate.Locator) Option
- func WithMetadata(metadata map[string]string) Option
- func WithName(name string) Option
- func WithRegistry(r registry.Registry) Option
- func WithServer(server network.Server) Option
- func WithSessionSecurity(signer crypto.Signer, suites ...aead.Suite) Option
- func WithSessionSecurityHandshakeTimeout(timeout time.Duration) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gate ¶
Gate is the gate server component.
func (*Gate) Close ¶ added in v2.2.3
func (g *Gate) Close()
Close closes the gate.
It switches the state to Hang and refreshes the service instance state, then waits for all online client sessions to exit naturally (graceful shutdown semantics).
func (*Gate) Destroy ¶
func (g *Gate) Destroy()
Destroy destroys the component.
It deregisters the service instance, stops the network server and the link server in turn, and cancels the component context.
type Option ¶
type Option func(o *options)
Option is a gate option.
func WithDispatch ¶ added in v2.3.0
WithDispatch sets the dispatch strategy of stateless route messages.
func WithExpose ¶ added in v2.3.0
WithExpose sets whether the internal communication address is exposed to the public network.
func WithLinkerCallTimeout ¶ added in v2.6.0
WithLinkerCallTimeout sets the RPC call timeout.
func WithLinkerCommandQueueSize ¶ added in v2.6.0
WithLinkerCommandQueueSize sets the message queue size.
func WithLinkerCommandWriteTimeout ¶ added in v2.6.0
WithLinkerCommandWriteTimeout sets the write timeout.
func WithLinkerConnNum ¶ added in v2.6.0
WithLinkerConnNum sets the number of connections.
func WithLinkerDialRetryTimes ¶ added in v2.6.0
WithLinkerDialRetryTimes sets the number of internal RPC dial retries.
func WithLinkerDialTimeout ¶ added in v2.6.0
WithLinkerDialTimeout sets the internal RPC dial timeout.
func WithLinkerFaultRecoveryTime ¶ added in v2.6.0
WithLinkerFaultRecoveryTime sets the internal RPC fault recovery time.
func WithLocator ¶
WithLocator sets the user locator.
func WithMetadata ¶ added in v2.3.0
WithMetadata sets the metadata.
func WithRegistry ¶
WithRegistry sets the service registry.
func WithSessionSecurity ¶ added in v2.6.3
WithSessionSecurity enables the session security between the client and the gate.
signer signs the ServerHello so that the client can verify the gate with the pinned public key. When no suite is given, the handshake defaults are used. When enabled, the payload of client messages is decrypted by the gate and re-encrypted for the downlink, so the node-side static encryptor must stay unconfigured.
func WithSessionSecurityHandshakeTimeout ¶ added in v2.6.3
WithSessionSecurityHandshakeTimeout sets how long the gate waits for a client to complete the session security handshake. A zero duration disables the timeout.