Пример #1
0
func main() {
	os.Remove("/tmp/whawty-sasl.sock")
	s, err := sasl.NewServer("/tmp/whawty-sasl.sock", callback)
	if err != nil {
		fmt.Printf("error initalizing server: %s\n", err)
		return
	}
	if err := s.Run(); err != nil {
		fmt.Printf("go error running server: %s", err)
	}
}
Пример #2
0
func runSaslAuthSocket(path string, store *StoreChan) error {
	os.Remove(path)
	s, err := sasl.NewServer(path, func(log string, pwd string, srv string, rlm string) (bool, string, error) {
		return callback(log, pwd, srv, rlm, path, store)
	})
	if err != nil {
		return err
	}
	wl.Printf("listening on '%s'", path)

	defer os.Remove(path)
	if err := s.Run(); err != nil {
		wl.Printf("error on sasl socket '%s': %s", path, err)
	}
	return nil
}