[agent/codex:gpt-5.4-mini] Read docs/RFC.md fully. Find ONE feature described in the sp... #77
2 changed files with 16 additions and 7 deletions
12
action.go
12
action.go
|
|
@ -29,8 +29,8 @@ type ActionDefinition struct {
|
|||
|
||||
// ActionRegistrar publishes DNS actions into another Core surface.
|
||||
//
|
||||
// registrar.RegisterAction(ActionHealth, func(map[string]any) (any, bool, error) {
|
||||
// return service.Health(), true, nil
|
||||
// registrar.RegisterAction(ActionResolve, func(values map[string]any) (any, bool, error) {
|
||||
// return service.ResolveAddress("gateway.charon.lthn")
|
||||
// })
|
||||
type ActionRegistrar interface {
|
||||
RegisterAction(name string, invoke func(map[string]any) (any, bool, error))
|
||||
|
|
@ -38,7 +38,11 @@ type ActionRegistrar interface {
|
|||
|
||||
// ActionCaller resolves named actions from another Core surface.
|
||||
//
|
||||
// aliases, ok, err := caller.CallAction(context.Background(), "blockchain.chain.aliases", map[string]any{})
|
||||
// aliases, ok, err := caller.CallAction(
|
||||
// context.Background(),
|
||||
// "blockchain.chain.aliases",
|
||||
// map[string]any{},
|
||||
// )
|
||||
type ActionCaller interface {
|
||||
CallAction(ctx context.Context, name string, values map[string]any) (any, bool, error)
|
||||
}
|
||||
|
|
@ -151,7 +155,7 @@ func (service *Service) RegisterActions(registrar ActionRegistrar) {
|
|||
|
||||
// NewServiceWithRegistrar builds a DNS service and registers its actions in one step.
|
||||
//
|
||||
// service := dns.NewServiceWithRegistrar(dns.ServiceOptions{}, registrar)
|
||||
// service := dns.NewServiceWithRegistrar(dns.ServiceConfiguration{}, registrar)
|
||||
// // registrar now exposes dns.resolve, dns.resolve.txt, dns.resolve.all, dns.reverse, dns.serve, dns.health, dns.discover
|
||||
func NewServiceWithRegistrar(options ServiceOptions, registrar ActionRegistrar) *Service {
|
||||
if registrar != nil {
|
||||
|
|
|
|||
11
service.go
11
service.go
|
|
@ -147,18 +147,23 @@ type ServiceOptions struct {
|
|||
ActionRegistrar ActionRegistrar
|
||||
}
|
||||
|
||||
// ServiceConfig is the preferred constructor shape for NewService.
|
||||
// ServiceConfiguration is the preferred constructor shape for NewService.
|
||||
//
|
||||
// service := dns.NewService(dns.ServiceConfig{
|
||||
// service := dns.NewService(dns.ServiceConfiguration{
|
||||
// Records: map[string]dns.NameRecords{
|
||||
// "gateway.charon.lthn": {A: []string{"10.10.10.10"}},
|
||||
// },
|
||||
// })
|
||||
type ServiceConfiguration = ServiceOptions
|
||||
|
||||
// ServiceConfig is kept for compatibility with older call sites.
|
||||
//
|
||||
// Deprecated: use ServiceConfiguration instead.
|
||||
type ServiceConfig = ServiceOptions
|
||||
|
||||
// Options is kept for compatibility with older call sites.
|
||||
//
|
||||
// Deprecated: use ServiceConfig instead.
|
||||
// Deprecated: use ServiceConfiguration instead.
|
||||
type Options = ServiceOptions
|
||||
|
||||
// NewService builds a DNS service from cached records and optional discovery hooks.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue