Skip to content

Commit

Permalink
Add lip2p options to router
Browse files Browse the repository at this point in the history
  • Loading branch information
phillebaba committed Feb 6, 2024
1 parent 46ef394 commit bf2272c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#343](https://github.com/XenitAB/spegel/pull/343) Implement image event and add support for delete events.
- [#344](https://github.com/XenitAB/spegel/pull/344) Add support for multi arch images.
- [#347](https://github.com/XenitAB/spegel/pull/347) Add support for a custom http transport when proxying requests.
- [#352](https://github.com/XenitAB/spegel/pull/352) Add lip2p options to router.

### Changed

Expand Down
6 changes: 3 additions & 3 deletions pkg/routing/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type P2PRouter struct {
registryPort uint16
}

func NewP2PRouter(ctx context.Context, addr string, bootstrapper Bootstrapper, registryPortStr string) (*P2PRouter, error) {
func NewP2PRouter(ctx context.Context, addr string, bootstrapper Bootstrapper, registryPortStr string, opts ...libp2p.Option) (*P2PRouter, error) {
registryPort, err := strconv.ParseUint(registryPortStr, 10, 16)
if err != nil {
return nil, err
Expand Down Expand Up @@ -65,11 +65,11 @@ func NewP2PRouter(ctx context.Context, addr string, bootstrapper Bootstrapper, r
}
return nil
})
opts := []libp2p.Option{
opts = append(opts,
libp2p.ListenAddrs(multiAddrs...),
libp2p.PrometheusRegisterer(metrics.DefaultRegisterer),
addrFactoryOpt,
}
)
host, err := libp2p.New(opts...)
if err != nil {
return nil, fmt.Errorf("could not create host: %w", err)
Expand Down

0 comments on commit bf2272c

Please sign in to comment.