[agent/codex:gpt-5.4-mini] Read docs/RFC.md fully. Find ONE feature described in the sp... #34
4 changed files with 8 additions and 10 deletions
|
|
@ -29,6 +29,7 @@ type ActionDefinition struct {
|
|||
// ActionRegistrar accepts named DNS action handlers from a service.
|
||||
//
|
||||
// service.RegisterActions(registrar)
|
||||
// registrar.RegisterAction("dns.health", func(map[string]any) (any, bool, error) { return service.Health(), true, nil })
|
||||
type ActionRegistrar interface {
|
||||
RegisterAction(name string, invoke func(map[string]any) (any, bool, error))
|
||||
}
|
||||
|
|
|
|||
6
go.sum
6
go.sum
|
|
@ -1,8 +1,5 @@
|
|||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ=
|
||||
github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
|
||||
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
|
||||
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
|
||||
|
|
@ -11,8 +8,5 @@ golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
|||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
|
||||
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
|
||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
||||
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
|
||||
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
|
||||
|
|
|
|||
|
|
@ -43,9 +43,10 @@ func (server *HTTPServer) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ServeHTTPHealth starts a minimal HTTP server exposing GET /health.
|
||||
// ServeHTTPHealth starts the health endpoint.
|
||||
//
|
||||
// server, err := service.ServeHTTPHealth("127.0.0.1", 5554)
|
||||
// defer func() { _ = server.Close() }()
|
||||
func (service *Service) ServeHTTPHealth(bind string, port int) (*HTTPServer, error) {
|
||||
if bind == "" {
|
||||
bind = "127.0.0.1"
|
||||
|
|
|
|||
8
serve.go
8
serve.go
|
|
@ -82,9 +82,10 @@ func (server *DNSServer) Close() error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Serve starts DNS over UDP and TCP at bind:port and returns a running server handle.
|
||||
// Serve starts DNS over UDP and TCP.
|
||||
//
|
||||
// srv, err := service.Serve("127.0.0.1", 53)
|
||||
// srv, err := service.Serve("0.0.0.0", 53)
|
||||
// defer func() { _ = srv.Close() }()
|
||||
func (service *Service) Serve(bind string, port int) (*DNSServer, error) {
|
||||
if bind == "" {
|
||||
bind = "127.0.0.1"
|
||||
|
|
@ -125,9 +126,10 @@ func (service *Service) Serve(bind string, port int) (*DNSServer, error) {
|
|||
return run, nil
|
||||
}
|
||||
|
||||
// ServeAll starts the DNS endpoint and the HTTP health endpoint together.
|
||||
// ServeAll starts DNS and health together.
|
||||
//
|
||||
// runtime, err := service.ServeAll("127.0.0.1", 53, 5554)
|
||||
// defer func() { _ = runtime.Close() }()
|
||||
func (service *Service) ServeAll(bind string, dnsPort int, httpPort int) (*ServiceRuntime, error) {
|
||||
dnsServer, err := service.Serve(bind, dnsPort)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue