dfsrconfig

package
v0.0.0-...-2e8e066 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed is returned from calls to a service or interface in the event
	// that the Close() function has already been called.
	ErrClosed = errors.New("interface is closing or already closed")

	// ErrDomainLookupFailed is returned when the appropriate domain naming
	// context cannot be determined.
	ErrDomainLookupFailed = errors.New("unable to determine DFSR configuration domain")
)

Functions

func Domain

func Domain(client *adsi.Client, domain string) (data dfsr.Domain, err error)

Domain will fetch DFSR configuration data from the specified domain using the provided ADSI client.

func Group

func Group(client *adsi.Client, domain, groupName string) (data dfsr.Group, err error)

Group will fetch DFSR configuration data for the replication group in the specified domain that matches the given name using the provided ADSI client.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is capable of perfroming LDAP queries to retrieve DFSR configuration.

func NewClient

func NewClient(client *adsi.Client, domain string) *Client

NewClient returns a new DFSR configuration client for the given domain.

The provided ADSI client is retained by the global settings and will be used internally to peform the necessary LDAP queries. It is the caller's responsibility to explicitly close the ADSI client at an appropriate time when finished with the global settings.

func (*Client) Computer

func (c *Client) Computer(dn string) (computer dfsr.Computer, err error)

Computer retrieves the DNS host name for the given distinguished name.

func (*Client) Domain

func (c *Client) Domain() (domain dfsr.Domain, err error)

Domain will fetch DFSR configuration data from the domain.

func (*Client) Group

func (c *Client) Group(groupDN string) (group dfsr.Group, err error)

Group retreives the DFSR group configuration for the given distinguished name.

func (*Client) GroupByName

func (c *Client) GroupByName(groupName string) (group dfsr.Group, err error)

GroupByName retreives the DFSR group configuration for the given name.

func (*Client) Groups

func (c *Client) Groups() (groups []dfsr.Group, err error)

Groups retreives the DFSR group configuration for all groups contained in the domain.

func (*Client) LocalSettings

func (c *Client) LocalSettings(settingsDN string) (settings dfsr.LocalSettings, err error)

LocalSettings retreives the DFSR local settings for the given distinguished name.

func (*Client) Member

func (c *Client) Member(memberDN string) (member dfsr.Member, err error)

Member retreives the DFSR member configuration for the given distinguished name. The member's connection list is included in the returned data.

func (*Client) MemberInfo

func (c *Client) MemberInfo(memberDN string) (member dfsr.MemberInfo, err error)

MemberInfo retreives the DFSR member configuration for the given distinguished name. The member's connection list is not included in the returned data.

func (*Client) NamingContext

func (c *Client) NamingContext() (nc dfsr.NamingContext, err error)

NamingContext returns information about the default naming context for the domain.

type DomainMonitor

type DomainMonitor struct {
	// contains filtered or unexported fields
}

DomainMonitor polls Active Directory for updated domain-wide DFSR configuration.

func NewDomainMonitor

func NewDomainMonitor(domain string, interval, timeout time.Duration) *DomainMonitor

NewDomainMonitor returns a new DFSR configuration monitor that polls Active Directory for updated DFSR configuration for a domain. If the provided domain is an empty string the monitor will attempt to use the the domain of the computer it is running on by querying the root domain naming context.

func (*DomainMonitor) Close

func (m *DomainMonitor) Close()

Close will release resources consumed by the monitor. It should be called when finished with the monitor. Calling close will prevent future calls to start or update from succeeding. Close will not return until all monitor-related goroutines have exited.

func (*DomainMonitor) Listen

func (m *DomainMonitor) Listen() <-chan DomainUpdate

Listen returns a channel on which configuration updates will be broadcast. The channel will be closed when the monitor is closed. If the monitor has already been closed then the returned channel will be closed already.

func (*DomainMonitor) Start

func (m *DomainMonitor) Start() error

Start starts the configuration monitor. If the monitor is already running start does nothing and returns nil. If it is unable to initialize an ADSI client start will return an error. If the monitor is already closed ErrClosed will be returned.

func (*DomainMonitor) Stop

func (m *DomainMonitor) Stop()

Stop stops the monitor and prevents further polling of Active Directory until Start is called again.

func (*DomainMonitor) Update

func (m *DomainMonitor) Update()

Update requests immediate retrieval of configuration data from Active Directory. It does not wait for the retrieval to complete.

If the monitor has not been started Update will do nothing.

func (*DomainMonitor) Value

func (m *DomainMonitor) Value() (cfg *dfsr.Domain, timestamp time.Time, err error)

Value returns the most recently retrieved domain configuration data, or nil if it has not yet acquired any data.

func (*DomainMonitor) WaitReady

func (m *DomainMonitor) WaitReady() (err error)

WaitReady blocks until the monitor has retrieved configuration data. If the monitor has already retrieved data the call will not block.

type DomainUpdate

type DomainUpdate struct {
	Domain    *dfsr.Domain
	Timestamp time.Time
	Err       error
}

DomainUpdate represents an update to domain configuration data.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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