Files
ngrok-go/rpc_handler.go
inconshreveable 6bc8021c53 Implement v2 API
See CHANGELOG.md for details.
2025-06-02 14:55:19 -07:00

21 lines
537 B
Go

package ngrok
import (
"context"
"golang.ngrok.com/ngrok/v2/rpc"
)
// RPCHandler is a function that processes RPC requests from the ngrok service.
// It receives the context, agent session, and request, and returns an optional
// response payload and error.
type RPCHandler func(context.Context, AgentSession, rpc.Request) ([]byte, error)
// Private request implementation that satisfies the rpc.Request interface
type rpcRequest struct {
method string
payload []byte
}
func (r *rpcRequest) Method() string { return r.method }