func (c *Conn) GetLink(ctx context.Context, ifindex int) (path string, err error) {
	err = c.Call(ctx, "GetLink", ifindex).Store(&path)
	return
}
GetLink takes a network interface index and returns the object path
to the org.freedesktop.resolve1.Link object corresponding to it.
ctx: Context to use
ifindex: The network interface index to get link for
package resolved
import (
	"context"
	"errors"
	"fmt"
	"net"
	"os"
	"strconv"
	"github.com/godbus/dbus/v5"
	"github.com/miekg/dns"
)
const (
	dbusDest      = "org.freedesktop.resolve1"
	dbusInterface = "org.freedesktop.resolve1.Manager"
	dbusPath      = "/org/freedesktop/resolve1"
)
type Conn struct {
	conn *dbus.Conn
	obj  dbus.BusObject
}
func NewConn() (*Conn, error) {
	conn, err := dbus.SystemBusPrivate()
	if err != nil {
		return nil, fmt.Errorf("failed to init private conn to system bus: %v", err)
	}
	methods := []dbus.Auth{dbus.AuthExternal(strconv.Itoa(os.Getuid()))}
	err = conn.Auth(methods)
	if err != nil {
		conn.Close()
		return nil, fmt.Errorf("failed to auth with external method: %v", err)
	}
	err = conn.Hello()
	if err != nil {
		conn.Close()
		return nil, fmt.Errorf("failed to make hello call: %v", err)
	}
	return &Conn{
		conn: conn,
		obj:  conn.Object(dbusDest, dbus.ObjectPath(dbusPath)),
	}, nil
}
func (c *Conn) Call(ctx context.Context, method string, args ...interface{}) *dbus.Call {
	return c.obj.CallWithContext(ctx, fmt.Sprintf("%s.%s", dbusInterface, method), 0, args...)
}
func (c *Conn) Close() error {
	return c.conn.Close()
}
const (
	SD_RESOLVED_DNS           = uint64(1) << 0
	SD_RESOLVED_LLMNR_IPV4    = uint64(1) << 1
	SD_RESOLVED_LLMNR_IPV6    = uint64(1) << 2
	SD_RESOLVED_MDNS_IPV4     = uint64(1) << 3
	SD_RESOLVED_MDNS_IPV6     = uint64(1) << 4
	SD_RESOLVED_NO_CNAME      = uint64(1) << 5
	SD_RESOLVED_NO_TXT        = uint64(1) << 6
	SD_RESOLVED_NO_ADDRESS    = uint64(1) << 7
	SD_RESOLVED_NO_SEARCH     = uint64(1) << 8
	SD_RESOLVED_AUTHENTICATED = uint64(1) << 9
)
type Address struct {
	IfIndex int     
	Family  int     
	Address net.IP  
}
func (a Address) String() string {
	return fmt.Sprintf(`{
	IfIndex: %d,
	Family:  %d,
	IP:      %s,
}`, a.IfIndex, a.Family, a.Address.String())
}
func (c *Conn) ResolveHostname(ctx context.Context, ifindex int, name string, family int, flags uint64) (addresses []Address, canonical string, outflags uint64, err error) {
	err = c.Call(ctx, "ResolveHostname", ifindex, name, family, flags).Store(&addresses, &canonical, &outflags)
	return
}
type Name struct {
	IfIndex  int     
	Hostname string  
}
func (n Name) String() string {
	return fmt.Sprintf(`{
	IfIndex: %d,
	Name:    %s,
}`, n.IfIndex, n.Hostname)
}
func (c *Conn) ResolveAddress(ctx context.Context, ifindex int, family int, address net.IP, flags uint64) (names []Name, outflags uint64, err error) {
	err = c.Call(ctx, "ResolveAddress", ifindex, family, address, flags).Store(&names, &outflags)
	return
}
type ResourceRecord struct {
	IfIndex int        
	Type    dns.Type   
	Class   dns.Class  
	Data []byte
}
func (r ResourceRecord) String() string {
	return fmt.Sprintf(`{
	IfIndex: %d,
	Type:    %s,
	Class:   %s,
	Data:    %v,
}`, r.IfIndex, r.Type.String(), r.Class.String(), r.Data)
}
func (r ResourceRecord) Unpack() (dns.RR, error) {
	rr, _, err := dns.UnpackRR(r.Data, 0)
	if err != nil {
		return nil, err
	}
	return rr, nil
}
func (r ResourceRecord) CNAME() (*dns.CNAME, error) {
	rr, err := r.Unpack()
	if err != nil {
		return nil, err
	}
	if rr.Header().Rrtype != dns.TypeCNAME {
		return nil, errors.New("not an CNAME record type")
	}
	cname, ok := rr.(*dns.CNAME)
	if !ok {
		return nil, errors.New("dns.RR is not a *dns.CNAME")
	}
	return cname, nil
}
func (r ResourceRecord) MX() (*dns.MX, error) {
	rr, err := r.Unpack()
	if err != nil {
		return nil, err
	}
	if rr.Header().Rrtype != dns.TypeMX {
		return nil, errors.New("not an MX record type")
	}
	mx, ok := rr.(*dns.MX)
	if !ok {
		return nil, errors.New("dns.RR is not a *dns.MX")
	}
	return mx, nil
}
func (r ResourceRecord) NS() (*dns.NS, error) {
	rr, err := r.Unpack()
	if err != nil {
		return nil, err
	}
	if rr.Header().Rrtype != dns.TypeNS {
		return nil, errors.New("not an NS record type")
	}
	ns, ok := rr.(*dns.NS)
	if !ok {
		return nil, errors.New("dns.RR is not a *dns.NS")
	}
	return ns, nil
}
func (r ResourceRecord) SRV() (*dns.SRV, error) {
	rr, err := r.Unpack()
	if err != nil {
		return nil, err
	}
	if rr.Header().Rrtype != dns.TypeSRV {
		return nil, errors.New("not an SRV record type")
	}
	srv, ok := rr.(*dns.SRV)
	if !ok {
		return nil, errors.New("dns.RR is not a *dns.SRV")
	}
	return srv, nil
}
func (r ResourceRecord) TXT() (*dns.TXT, error) {
	rr, err := r.Unpack()
	if err != nil {
		return nil, err
	}
	if rr.Header().Rrtype != dns.TypeTXT {
		return nil, errors.New("not an TXT record type")
	}
	txt, ok := rr.(*dns.TXT)
	if !ok {
		return nil, errors.New("dns.RR is not a *dns.TXT")
	}
	return txt, nil
}
func (c *Conn) ResolveRecord(ctx context.Context, ifindex int, name string, class dns.Class, rtype dns.Type, flags uint64) (records []ResourceRecord, outflags uint64, err error) {
	err = c.Call(ctx, "ResolveRecord", ifindex, name, class, rtype, flags).Store(&records, &outflags)
	return
}
type SRVRecord struct {
	Priority  uint16
	Weight    uint16
	Port      uint16
	Hostname  string
	Addresses []Address
	CNAME     string
}
func (r SRVRecord) String() string {
	return fmt.Sprintf(`{
	Priority:  %d,
	Weight:    %d,
	Port:      %d,
	Hostname:  %s,
	Addresses: %v,
}`, r.Priority, r.Weight, r.Port, r.Hostname, r.Addresses)
}
type TXTRecord []byte
func (r TXTRecord) String() string {
	return string(r)
}
func (c *Conn) ResolveService(ctx context.Context, ifindex int, name string, stype string, domain string, family int,
	flags uint64) (srvData []SRVRecord, txtData []TXTRecord, canonicalName string, canonicalType string, canonicalDomain string, outflags uint64, err error) {
	err = c.Call(ctx, "ResolveService", ifindex, name, stype, domain, family, flags).Store(&srvData, &txtData, &canonicalName, &canonicalType, &canonicalDomain, &outflags)
	return
}