Documentation
¶
Index ¶
- Constants
- func GetProtocol() base.Protocol
- type DubboInvoker
- type MethodInfo
- type Option
- func Http3Enable() Option
- func Http3Negotiation(negotiation bool) Option
- func WithKeepAlive(interval, timeout time.Duration) Option
- func WithKeepAliveInterval(interval time.Duration) Option
- func WithKeepAliveTimeout(timeout time.Duration) Option
- func WithMaxServerRecvMsgSize(size string) Option
- func WithMaxServerSendMsgSize(size string) Option
- type Options
- type Server
- type ServiceInfo
- type TripleExporter
- type TripleInvoker
- type TripleProtocol
Constants ¶
const (
// TRIPLE protocol name
TRIPLE = "tri"
)
Variables ¶
This section is empty.
Functions ¶
func GetProtocol ¶
Types ¶
type DubboInvoker ¶
type DubboInvoker struct {
base.BaseInvoker
// contains filtered or unexported fields
}
DubboInvoker is implement of protocol.Invoker, a dubboInvoker refer to one service and ip.
func NewDubbo3Invoker ¶
func NewDubbo3Invoker(url *common.URL) (*DubboInvoker, error)
NewDubbo3Invoker constructor
func (*DubboInvoker) Destroy ¶
func (di *DubboInvoker) Destroy()
Destroy destroy dubbo3 client invoker.
func (*DubboInvoker) Invoke ¶
func (di *DubboInvoker) Invoke(ctx context.Context, invocation base.Invocation) result.Result
Invoke call remoting.
func (*DubboInvoker) IsAvailable ¶
func (di *DubboInvoker) IsAvailable() bool
IsAvailable check if invoker is available, now it is useless
type MethodInfo ¶
type Option ¶ added in v3.3.1
type Option func(*Options)
func Http3Enable ¶ added in v3.3.1
func Http3Enable() Option
Http3Enable enables HTTP/3 support for the Triple protocol. This option configures the server to start both HTTP/2 and HTTP/3 servers simultaneously, providing modern HTTP/3 capabilities alongside traditional HTTP/2.
When enabled, the server will:
- Start an HTTP/3 server using QUIC protocol
- Continue running the existing HTTP/2 server
- Enable protocol negotiation between HTTP/2 and HTTP/3
- Provide improved performance and security benefits of HTTP/3
Usage Examples:
// Basic HTTP/3 enablement
server := triple.NewServer(
triple.Http3Enable(),
)
Requirements:
- TLS configuration is required for HTTP/3
- Server must have valid TLS certificates
- Clients must support HTTP/3 for full benefits
- Fallback to HTTP/2 is automatic for unsupported clients
Default Behavior:
- HTTP/3 is disabled by default for backward compatibility
- When enabled, negotiation defaults to true
- Both HTTP/2 and HTTP/3 servers run on the same port
Experimental ¶
NOTICE: This API is EXPERIMENTAL and may be changed or removed in a later release.
func Http3Negotiation ¶ added in v3.3.1
Http3Negotiation configures HTTP/3 negotiation behavior for the Triple protocol. This option controls whether HTTP/2 Alternative Services (Alt-Svc) negotiation is enabled when both HTTP/2 and HTTP/3 servers are running simultaneously.
Usage Examples:
// Enable HTTP/3 negotiation (default behavior)
server := triple.NewServer(
triple.Http3Enable(),
triple.Http3Negotiation(true),
)
// Disable HTTP/3 negotiation for explicit protocol control
server := triple.NewServer(
triple.Http3Enable(),
triple.Http3Negotiation(false),
)
Default Behavior:
- When HTTP/3 is enabled, negotiation defaults to true
- This ensures backward compatibility and optimal client experience
Experimental ¶
NOTICE: This API is EXPERIMENTAL and may be changed or removed in a later release.
func WithKeepAlive ¶ added in v3.3.1
WithKeepAlive sets the keep-alive interval and timeout for the Triple protocol. interval: The duration between keep-alive pings. timeout: The duration to wait for a keep-alive response before considering the connection dead. If not set, default interval is 10s, default timeout is 20s.
func WithKeepAliveInterval ¶ added in v3.3.1
WithKeepAliveInterval sets the keep-alive interval for the Triple protocol. interval: The duration between keep-alive pings. If not set, default interval is 10s.
func WithKeepAliveTimeout ¶ added in v3.3.1
WithKeepAliveTimeout sets the keep-alive timeout for the Triple protocol. timeout: The duration to wait for a keep-alive response before considering the connection dead. If not set, default timeout is 20s.
func WithMaxServerRecvMsgSize ¶ added in v3.3.1
WithMaxServerRecvMsgSize sets the maximum size of messages that the server can receive. size: The maximum message size in bytes, specified as a string (e.g., "4MB"). If not set, default value is 4MB (4194304 bytes).
func WithMaxServerSendMsgSize ¶ added in v3.3.1
WithMaxServerSendMsgSize sets the maximum size of messages that the server can send. size: The maximum message size in bytes, specified as a string (e.g., "4MB"). If not set, default value is 2147MB (math.MaxInt32).
type Options ¶ added in v3.3.1
type Options struct {
Triple *global.TripleConfig
}
TODO: The triple options for the server and client are mixed together now. We need to find a way to separate them later.
func NewOptions ¶ added in v3.3.1
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is TRIPLE adaptation layer representation. It makes use of tri.Server to provide functionality.
func NewServer ¶
func NewServer(cfg *global.TripleConfig) *Server
NewServer creates a new TRIPLE server.
func (*Server) GetServiceInfo ¶
func (s *Server) GetServiceInfo() map[string]grpc.ServiceInfo
func (*Server) RefreshService ¶
func (s *Server) RefreshService(invoker base.Invoker, info *common.ServiceInfo)
todo(DMwangnima): extract a common function RefreshService refreshes Triple Service
type ServiceInfo ¶
type ServiceInfo struct {
InterfaceName string
ServiceType any
Methods []MethodInfo
Meta map[string]any
}
type TripleExporter ¶
type TripleExporter struct {
*base.BaseExporter
}
TripleExporter wraps BaseExporter
func NewTripleExporter ¶
func (*TripleExporter) UnExport ¶
func (te *TripleExporter) UnExport()
UnExport and unregister Triple service from registry and memory.
type TripleInvoker ¶
type TripleInvoker struct {
base.BaseInvoker
// contains filtered or unexported fields
}
func NewTripleInvoker ¶
func NewTripleInvoker(url *common.URL) (*TripleInvoker, error)
func (*TripleInvoker) Destroy ¶
func (ti *TripleInvoker) Destroy()
Destroy will destroy Triple's invoker and client, so it is only called once
func (*TripleInvoker) Invoke ¶
func (ti *TripleInvoker) Invoke(ctx context.Context, invocation base.Invocation) result.Result
Invoke is used to call client-side method.
func (*TripleInvoker) IsAvailable ¶
func (ti *TripleInvoker) IsAvailable() bool
IsAvailable get available status
func (*TripleInvoker) IsDestroyed ¶
func (ti *TripleInvoker) IsDestroyed() bool
IsDestroyed get destroyed status
type TripleProtocol ¶
type TripleProtocol struct {
base.BaseProtocol
// contains filtered or unexported fields
}
func NewTripleProtocol ¶
func NewTripleProtocol() *TripleProtocol
func (*TripleProtocol) Destroy ¶
func (tp *TripleProtocol) Destroy()
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
triple_health
Code generated by protoc-gen-triple.
|
Code generated by protoc-gen-triple. |
|
triple_reflection
Code generated by protoc-gen-triple.
|
Code generated by protoc-gen-triple. |
|
Package triple is a slim RPC framework built on Protocol Buffers and net/http.
|
Package triple is a slim RPC framework built on Protocol Buffers and net/http. |
|
internal/assert
Package assert is a minimal assert package using reflection.
|
Package assert is a minimal assert package using reflection. |
|
internal/gen/proto/connect/ping/v1/pingv1connect
The connect.ping.v1 package contains an echo service designed to test the connect-go implementation.
|
The connect.ping.v1 package contains an echo service designed to test the connect-go implementation. |