Skip to content

Commit

Permalink
feat: switch to multiaddr uri syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Jun 17, 2024
1 parent e281a31 commit 6977888
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions module.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

func init() {
//caddy.RegisterModule(new(LL))
caddy.RegisterNetwork("multiaddr", registerMultiaddrURI)
caddy.RegisterNetwork("multiaddr:", registerMultiaddrURI)
}

func registerMultiaddrURI(ctx context.Context, network, addr string, cfg net.ListenConfig) (any, error) {
Expand All @@ -33,7 +33,7 @@ func registerMultiaddrURI(ctx context.Context, network, addr string, cfg net.Lis
return nil, fmt.Errorf("context is not a caddy.Context: %T", ctx)
}

if network != "multiaddr" {
if network != "multiaddr:" {
return nil, fmt.Errorf("multiaddr URI network only handles multiaddr URIs")
}

Expand All @@ -48,7 +48,7 @@ func registerMultiaddrURI(ctx context.Context, network, addr string, cfg net.Lis
}
addr = addr[:lastColon]

ma, err := multiaddr.NewMultiaddr(addr)
ma, err := multiaddr.NewMultiaddr("/" + addr)
if err != nil {
return nil, fmt.Errorf("could not parse multiaddr: %w", err)
}
Expand Down

0 comments on commit 6977888

Please sign in to comment.