Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type Config struct {
BindAddr string `split_words:"true"`
CardanoConfig string ` envconfig:"config"`
DatabasePath string `split_words:"true"`
SocketPath string `split_words:"true"`
IntersectTip bool `split_words:"true"`
Network string
MetricsPort uint `split_words:"true"`
Expand All @@ -38,6 +39,7 @@ var globalConfig = &Config{
BindAddr: "0.0.0.0",
CardanoConfig: "./configs/cardano/preview/config.json",
DatabasePath: ".dingo",
SocketPath: "dingo.socket",
IntersectTip: false,
Network: "preview",
MetricsPort: 12798,
Expand Down
36 changes: 27 additions & 9 deletions internal/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,31 @@ func Run(logger *slog.Logger) error {
fmt.Sprintf("topology: %+v", config.GetTopologyConfig()),
"component", "node",
)
l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", cfg.BindAddr, cfg.Port))
tcpNtN, err := net.Listen(
"tcp",
fmt.Sprintf("%s:%d", cfg.BindAddr, cfg.Port),
)
if err != nil {
return err
}
logger.Info(
fmt.Sprintf(
"listening for ouroboros node-to-node connections on %s",
fmt.Sprintf("%s:%d", cfg.BindAddr, cfg.Port),
),
"component", "node",
)
socketNtC, err := net.Listen("unix", cfg.SocketPath)
if err != nil {
return err
}
logger.Info(
fmt.Sprintf(
"listening for ouroboros node-to-client connections on socket %s",
cfg.SocketPath,
),
"component", "node",
)
var nodeCfg *cardano.CardanoNodeConfig
if cfg.CardanoConfig != "" {
tmpCfg, err := cardano.NewCardanoNodeConfigFromFile(cfg.CardanoConfig)
Expand All @@ -59,13 +80,6 @@ func Run(logger *slog.Logger) error {
"component", "node",
)
}
logger.Info(
fmt.Sprintf(
"listening for ouroboros node-to-node connections on %s",
fmt.Sprintf("%s:%d", cfg.BindAddr, cfg.Port),
),
"component", "node",
)
d, err := dingo.New(
dingo.NewConfig(
dingo.WithIntersectTip(cfg.IntersectTip),
Expand All @@ -75,7 +89,11 @@ func Run(logger *slog.Logger) error {
dingo.WithCardanoNodeConfig(nodeCfg),
dingo.WithListeners(
dingo.ListenerConfig{
Listener: l,
Listener: tcpNtN,
},
dingo.ListenerConfig{
Listener: socketNtC,
UseNtC: true,
},
),
// Enable metrics with default prometheus registry
Expand Down
Loading