Help us shape the future of Go! Take the 2026 Go Developer Survey

surfdap

package module
v0.0.0-...-a786a47 Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

README

SurfDAP - Go LDAP client for human beings

GoDoc

Installation

$ go get -v -u github.com/octogo/surfdap
$ go install github.com/octogo/surfdap/surfdap

Usage

Shell
$ surfdap search --help
Embed
package main

import (
    "fmt"
    "os"

    "github.com/octogo/surfdap"
)

func main() {
    surfer, err := surfdap.New("localhost", 389, false, "dc=example,dc=com", "", "")
    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }

    fmt.Println(surfer)
    // dn: dc=example,dc=org
    // objectClass: dcObject
    // objectClass: organization
    // dc: example
    // o: Example Org

    surfer.Entry()
    // Return *ldap.Entry of the underlaying LDAP object.

    surfer.Parent()
    // Returns a surfdap.Surfer for the parent object of this object.

    surfer.Lookup(
        surfdap.One,
        surfdap.Filter("(objectClass=*)"),
        nil,
    )
}

Documentation

Overview

Package surfdap provides primitives for navigating an LDAP directory tree.

Index

Constants

Available search scopes

Variables

View Source
var (
	SizeLimit = 0
	TimeLimit = 0
)

Limits

Functions

This section is empty.

Types

type Filter

type Filter string

Filter defines the type of a search filter.

type OnlyAttrs

type OnlyAttrs []string

OnlyAttrs defines the type of an attribute filter.

type S

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

S implements the Surfer interface.

func New

func New(host string, port uint16, startTLS bool, baseDn, bindDn, bindPW string) (*S, error)

New returns a newly initialized Surfer.

func (*S) Entry

func (s *S) Entry() *ldap.Entry

Entry returns the *ldap.Entry of this node.

func (*S) Lookup

func (s *S) Lookup(scope Scope, filter Filter, attrs OnlyAttrs) ([]Surfer, error)

Lookup performs an LDAP search and returns a set of new surfers.

func (*S) Parent

func (s *S) Parent() Surfer

Parent returns the parent node of this node.

func (S) String

func (s S) String() string

type Scope

type Scope int

Scope defines the type for an LDAP search scope.

type Surfer

type Surfer interface {
	Lookup(Scope, Filter, OnlyAttrs) ([]Surfer, error)
	Entry() *ldap.Entry
	Parent() Surfer
}

Surfer defines the interface of an LDAP surfer.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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