forked from TrueCloudLab/frostfs-sdk-go
[#170] oid, cid: Refactor and document package functionality
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
24d6c2221f
commit
f7172adf18
49 changed files with 831 additions and 439 deletions
14
ns/dns.go
14
ns/dns.go
|
@ -16,20 +16,20 @@ type DNS struct{}
|
|||
// Otherwise, returns an error.
|
||||
//
|
||||
// See also net.LookupTXT.
|
||||
func (x *DNS) ResolveContainerName(name string) (*cid.ID, error) {
|
||||
func (x *DNS) ResolveContainerName(name string) (id cid.ID, err error) {
|
||||
records, err := net.LookupTXT(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return
|
||||
}
|
||||
|
||||
var id cid.ID
|
||||
|
||||
for i := range records {
|
||||
err = id.Parse(records[i])
|
||||
err = id.DecodeString(records[i])
|
||||
if err == nil {
|
||||
return &id, nil
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return nil, errNotFound
|
||||
err = errNotFound
|
||||
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue