package main import ( "log" "os" "os/signal" "syscall" ldap "github.com/vjeantet/ldapserver" "gt.kalli.st/czar/fsldap/handler" ) func main() { server := ldap.NewServer() routes := ldap.NewRouteMux() routes.Bind(handler.Bind) routes.Extended(handler.WhoAmI). RequestName(ldap.NoticeOfWhoAmI).Label("Ext - WhoAmI") routes.Search(handler.Search).Label("Search - Generic") server.Handle(routes) log.Print("Starting FSLDAP server...") go func(){ err := server.ListenAndServe("127.0.0.1:389") if err != nil{ log.Fatal(err) } }() ch := make(chan os.Signal) signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) <-ch close(ch) server.Stop() }