go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/network/connection/connection.go (about)

     1  // Copyright (c) Mondoo, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package connection
     5  
     6  import (
     7  	"go.mondoo.com/cnquery/providers-sdk/v1/inventory"
     8  )
     9  
    10  type HostConnection struct {
    11  	id    uint32
    12  	Conf  *inventory.Config
    13  	asset *inventory.Asset
    14  }
    15  
    16  func NewHostConnection(id uint32, asset *inventory.Asset, conf *inventory.Config) *HostConnection {
    17  	return &HostConnection{
    18  		Conf:  conf,
    19  		id:    id,
    20  		asset: asset,
    21  	}
    22  }
    23  
    24  func (h *HostConnection) Name() string {
    25  	return "host"
    26  }
    27  
    28  func (h *HostConnection) ID() uint32 {
    29  	return h.id
    30  }
    31  
    32  func (p *HostConnection) Asset() *inventory.Asset {
    33  	return p.asset
    34  }
    35  
    36  func (p *HostConnection) FQDN() string {
    37  	if p.Conf == nil {
    38  		return ""
    39  	}
    40  	return p.Conf.Host
    41  }