modulepackage
0.0.0-20241106080618-49c2edc1411d
Repository: https://github.com/iredmail/ldappool.git
Documentation: pkg.go.dev
# README
How to use it ?
package main
import(
"fmt"
"log"
"github.com/go-ldap/ldap/v3"
"github.com/iredmail/ldappool"
)
func main() {
opts := []ldappool.Option{
ldappool.WithMaxConnections(10),
ldappool.WithBindCredentials("dn", "password"),
}
pool, err := ldappool.New("ldap://ldap.example.com:389", opts...)
if err != nil {
log.Fatal(err)
}
defer pool.Close()
searchRequest := ldap.NewSearchRequest(
"dc=example,dc=com", // The base dn to search
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
"(&(objectClass=organizationalPerson))", // The filter to apply
[]string{"dn", "cn"}, // A list attributes to retrieve
nil,
)
sr, err := pool.Search(searchRequest)
if err != nil {
log.Fatal(err)
}
for _, entry := range sr.Entries {
fmt.Printf("%s: %v\n", entry.DN, entry.GetAttributeValue("cn"))
}
}
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author