MCPcopy Create free account
hub / github.com/encodeous/nylon / ResolveSRV

Function ResolveSRV

state/dns.go:48–58  ·  view source on GitHub ↗

ResolveSRV resolves an SRV record using the default resolver

(ctx context.Context, service, proto, name string)

Source from the content-addressed store, hash-verified

46
47// ResolveSRV resolves an SRV record using the default resolver
48func ResolveSRV(ctx context.Context, service, proto, name string) (string, uint16, error) {
49 _, addrs, err := net.DefaultResolver.LookupSRV(ctx, service, proto, name)
50 if err != nil {
51 return "", 0, err
52 }
53 if len(addrs) == 0 {
54 return "", 0, fmt.Errorf("no SRV records found")
55 }
56 // Return the first SRV target and port
57 return strings.TrimSuffix(addrs[0].Target, "."), addrs[0].Port, nil
58}

Callers 1

RefreshMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected