-
Notifications
You must be signed in to change notification settings - Fork 15
/
enr.go
40 lines (34 loc) · 863 Bytes
/
enr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package enr
import (
"github.com/protolambda/ask"
"github.com/protolambda/rumor/control/actor/base"
"github.com/protolambda/rumor/p2p/peering/enrstate"
)
type LazyEnrState struct {
Current *enrstate.EnrState
}
type EnrCmd struct {
*base.Base
Lazy *LazyEnrState
base.PrivSettings
base.WithHostPriv
}
func (c *EnrCmd) Cmd(route string) (cmd interface{}, err error) {
switch route {
case "view":
cmd = &EnrViewCmd{Base: c.Base, Lazy: c.Lazy}
case "gen-key":
cmd = &EnrGenKeyCmd{Base: c.Base}
case "make":
cmd = &EnrMakeCmd{Base: c.Base, Lazy: c.Lazy, PrivSettings: c.PrivSettings, WithHostPriv: c.WithHostPriv}
default:
return nil, ask.UnrecognizedErr
}
return cmd, nil
}
func (c *EnrCmd) Routes() []string {
return []string{"view", "gen-key", "make"}
}
func (c *EnrCmd) Help() string {
return "Ethereum Name Record (ENR) utilities"
}