mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-05-25 16:00:35 +00:00
65a09208c4
Merge 3 independent channel HTTP servers (LINE :18791, WeCom Bot :18793, WeCom App :18792) and the health server (:18790) into a single shared HTTP server on the Gateway address. Channels implement WebhookHandler and/or HealthChecker interfaces to register their handlers on the shared mux. Also change Gateway default host from 0.0.0.0 to 127.0.0.1 for security.
21 lines
720 B
Go
21 lines
720 B
Go
package channels
|
|
|
|
import "net/http"
|
|
|
|
// WebhookHandler is an optional interface for channels that receive messages
|
|
// via HTTP webhooks. Manager discovers channels implementing this interface
|
|
// and registers them on the shared HTTP server.
|
|
type WebhookHandler interface {
|
|
// WebhookPath returns the path to mount this handler on the shared server.
|
|
// Examples: "/webhook/line", "/webhook/wecom"
|
|
WebhookPath() string
|
|
http.Handler // ServeHTTP(w http.ResponseWriter, r *http.Request)
|
|
}
|
|
|
|
// HealthChecker is an optional interface for channels that expose
|
|
// a health check endpoint on the shared HTTP server.
|
|
type HealthChecker interface {
|
|
HealthPath() string
|
|
HealthHandler(w http.ResponseWriter, r *http.Request)
|
|
}
|