objects

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Computer

type Computer struct {
	// LdapSession is the LDAP session object
	LdapSession LdapSessionInterface
	// DistinguishedName is the distinguished name of the computer
	DistinguishedName string
	// DNSHostname is the DNS hostname of the computer
	DNSHostname []string
}

type Domain

type Domain struct {
	// LdapSession is the LDAP session object
	LdapSession LdapSessionInterface

	// DistinguishedName is the distinguished name of the domain
	DistinguishedName string

	// NetBIOSName is the NetBIOS name of the domain
	NetBIOSName string

	// DNSName is the DNS name of the domain
	DNSName string

	// SID is the SID of the domain
	SID string
}

func (*Domain) GetAllComputers

func (domain *Domain) GetAllComputers() (map[string]*Computer, error)

GetAllComputers retrieves all computer objects from the LDAP directory.

This function performs an LDAP search to find all objects with the objectClass "computer" within the domain's distinguished name. It retrieves the distinguished name and DNS hostname attributes for each computer object and constructs a map of Computer objects.

Returns:

  • A map where the keys are the distinguished names of the computer objects and the values are pointers to Computer objects representing the retrieved computer objects.

Example usage:

domain := &Domain{LdapSession: ldapSession, DistinguishedName: "DC=example,DC=com"}
computers := domain.GetAllComputers()
for dn, computer := range computers {
    fmt.Printf("Computer DN: %s, DNS Hostname: %v\n", dn, computer.DNSHostname)
}

func (*Domain) GetDomainFunctionalityLevel added in v1.0.3

func (domain *Domain) GetDomainFunctionalityLevel() (ldap_attributes.DomainFunctionalityLevel, error)

GetDomainFunctionalityLevel gets the domain's functionality level.

func (*Domain) IsDomainFunctionalityLevelEqualTo added in v1.0.3

func (domain *Domain) IsDomainFunctionalityLevelEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)

IsDomainFunctionalityLevelEqualTo checks if the domain's functionality level is equal to the specified level.

func (*Domain) IsDomainFunctionalityLevelGreaterThan added in v1.0.3

func (domain *Domain) IsDomainFunctionalityLevelGreaterThan(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)

IsDomainFunctionalityLevelGreaterThan checks if the domain's functionality level is greater than the specified level.

func (*Domain) IsDomainFunctionalityLevelGreaterThanOrEqualTo added in v1.0.3

func (domain *Domain) IsDomainFunctionalityLevelGreaterThanOrEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)

IsDomainFunctionalityLevelGreaterThanOrEqualTo checks if the domain's functionality level is greater than or equal to the specified level.

func (*Domain) IsDomainFunctionalityLevelLowerThan added in v1.0.3

func (domain *Domain) IsDomainFunctionalityLevelLowerThan(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)

IsDomainFunctionalityLevelLowerThan checks if the domain's functionality level is lower than the specified level.

func (*Domain) IsDomainFunctionalityLevelLowerThanOrEqualTo added in v1.0.3

func (domain *Domain) IsDomainFunctionalityLevelLowerThanOrEqualTo(functionalityLevel ldap_attributes.DomainFunctionalityLevel) (bool, error)

IsDomainFunctionalityLevelLowerThanOrEqualTo checks if the domain's functionality level is lower than or equal to the specified level.

type LdapSessionInterface

type LdapSessionInterface interface {
	Connect() (bool, error)

	ReConnect() (bool, error)

	Close()

	// Query functions
	Query(searchBase string, query string, attributes []string, scope int) ([]*ldap.Entry, error)

	QueryWholeSubtree(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)

	QueryBaseObject(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)

	QuerySingleLevel(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)

	QueryChildren(searchBase string, query string, attributes []string) ([]*ldap.Entry, error)

	// Domain functions
	GetDomain(distinguishedName string) (*Domain, error)
}

type User

type User struct {
	// LdapSession is the LDAP session object
	LdapSession LdapSessionInterface
	// DistinguishedName is the distinguished name of the user
	DistinguishedName string
	// sAMAccountName is the sAMAccountName of the user
	SamAccountName string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL