find replace
This commit is contained in:
parent
f9efbc8067
commit
4aa49f17ea
|
@ -7,7 +7,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
"github.com/multiformats/go-varint"
|
||||
)
|
||||
|
||||
|
@ -79,7 +78,7 @@ func (c *Component) Protocols() []Protocol {
|
|||
|
||||
func (c *Component) ValueForProtocol(code int) (string, error) {
|
||||
if c.protocol.Code != code {
|
||||
return "", multiaddr.ErrProtocolNotFound
|
||||
return "", ErrProtocolNotFound
|
||||
}
|
||||
return c.Value(), nil
|
||||
}
|
||||
|
@ -110,7 +109,7 @@ func (c *Component) String() string {
|
|||
return b.String()
|
||||
}
|
||||
|
||||
// writeTo is an efficient, private function for string-formatting a multiaddr.
|
||||
// writeTo is an efficient, private function for string-formatting a multiprotocol.
|
||||
// Trust me, we tend to allocate a lot when doing this.
|
||||
func (c *Component) writeTo(b *strings.Builder) {
|
||||
b.WriteByte('/')
|
||||
|
@ -123,7 +122,7 @@ func (c *Component) writeTo(b *strings.Builder) {
|
|||
b.WriteString(value)
|
||||
}
|
||||
|
||||
// NewComponent constructs a new multiaddr component
|
||||
// NewComponent constructs a new multiprotocol component
|
||||
func NewComponent(protocol, value string) (*Component, error) {
|
||||
p := ProtocolWithName(protocol)
|
||||
if p.Code == 0 {
|
||||
|
|
|
@ -137,7 +137,7 @@ func (m *multiprotocol) Protocols() []Protocol {
|
|||
return ps
|
||||
}
|
||||
|
||||
var ErrProtocolNotFound = fmt.Errorf("protocol not found in multiaddr")
|
||||
var ErrProtocolNotFound = fmt.Errorf("protocol not found in multiprotocol")
|
||||
|
||||
func (m *multiprotocol) ValueForProtocol(code int) (value string, err error) {
|
||||
err = ErrProtocolNotFound
|
||||
|
|
|
@ -42,7 +42,7 @@ type Protocol struct {
|
|||
var protocolsByName = map[string]Protocol{}
|
||||
var protocolsByCode = map[int]Protocol{}
|
||||
|
||||
// Protocols is the list of multiaddr protocols supported by this module.
|
||||
// Protocols is the list of multiprotocol protocols supported by this module.
|
||||
var Protocols = []Protocol{}
|
||||
|
||||
func AddProtocol(p Protocol) error {
|
||||
|
|
Loading…
Reference in New Issue