Documentation ¶
Index ¶
- Variables
- func GetAvailableObjectClass(clt ldap.Client) (sets.Set[string], error)
- func IsLdapError(err error, errCode ...uint16) bool
- func WithConnContext(ctx context.Context, client ldap.Client) context.Context
- type Client
- func (l Client) Close()
- func (l Client) Marshal() ([]byte, error)
- func (l Client) MarshalJSON() ([]byte, error)
- func (l *Client) Merge(src proto.Message)
- func (l *Client) Options() *LdapOptions
- func (l *Client) ProtoMessage()
- func (l *Client) Reset()
- func (l *Client) Session(ctx context.Context) ldap.Client
- func (l Client) String() string
- func (l *Client) Unmarshal(data []byte) (err error)
- func (l *Client) UnmarshalJSON(data []byte) (err error)
- type LdapOptions
- func (*LdapOptions) Descriptor() ([]byte, []int)
- func (m *LdapOptions) GetAppObjectClass() string
- func (m *LdapOptions) GetAppSearchBase() string
- func (m *LdapOptions) GetAppSearchFilter() string
- func (m *LdapOptions) GetAttrEmail() string
- func (m *LdapOptions) GetAttrUserDisplayName() string
- func (m *LdapOptions) GetAttrUserPhoneNo() string
- func (m *LdapOptions) GetAttrUsername() string
- func (m *LdapOptions) GetHost() string
- func (m *LdapOptions) GetIsTLS() bool
- func (m *LdapOptions) GetManagerDn() string
- func (m *LdapOptions) GetStartTLS() bool
- func (m *LdapOptions) GetUserSearchBase() string
- func (m *LdapOptions) GetUserSearchFilter() string
- func (x *LdapOptions) ParseUserSearchFilter(username ...string) string
- func (*LdapOptions) ProtoMessage()
- func (m *LdapOptions) Reset()
- func (m *LdapOptions) String() string
- func (x *LdapOptions) UnmarshalJSONPB(unmarshaller *jsonpb.Unmarshaler, b []byte) error
- func (x *LdapOptions) Valid() error
- func (m *LdapOptions) XXX_DiscardUnknown()
- func (m *LdapOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *LdapOptions) XXX_Merge(src proto.Message)
- func (m *LdapOptions) XXX_Size() int
- func (m *LdapOptions) XXX_Unmarshal(b []byte) error
- type NopCloser
- type Pool
- type PoolConn
- func (p *PoolConn) Add(addRequest *ldap.AddRequest) error
- func (p *PoolConn) Bind(username, password string) error
- func (p *PoolConn) Close()
- func (p *PoolConn) Compare(dn, attribute, value string) (bool, error)
- func (p *PoolConn) Del(delRequest *ldap.DelRequest) error
- func (p *PoolConn) ExternalBind() error
- func (p *PoolConn) IsClosing() bool
- func (p *PoolConn) MarkUnusable()
- func (p *PoolConn) Modify(modifyRequest *ldap.ModifyRequest) error
- func (p *PoolConn) ModifyDN(modifyDNRequest *ldap.ModifyDNRequest) error
- func (p *PoolConn) ModifyWithResult(request *ldap.ModifyRequest) (*ldap.ModifyResult, error)
- func (p *PoolConn) NTLMUnauthenticatedBind(domain, username string) error
- func (p *PoolConn) PasswordModify(passwordModifyRequest *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)
- func (p *PoolConn) Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
- func (p *PoolConn) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error)
- func (p *PoolConn) SetTimeout(t time.Duration)
- func (p *PoolConn) SimpleBind(simpleBindRequest *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)
- func (p *PoolConn) Start()
- func (p *PoolConn) StartTLS(config *tls.Config) error
- func (p *PoolConn) TLSConnectionState() (tls.ConnectionState, bool)
- func (p *PoolConn) UnauthenticatedBind(username string) error
- func (p *PoolConn) Unbind() error
- type PoolFactory
- type Session
- func (s *Session) Add(addRequest *ldap.AddRequest) (err error)
- func (s *Session) Bind(username, password string) (err error)
- func (s *Session) Close()
- func (s *Session) Compare(dn, attribute, value string) (bool, error)
- func (s *Session) Del(delRequest *ldap.DelRequest) (err error)
- func (s *Session) Error() error
- func (s *Session) ExternalBind() error
- func (s *Session) IsClosing() bool
- func (s *Session) Modify(modifyRequest *ldap.ModifyRequest) (err error)
- func (s *Session) ModifyDN(modifyDNRequest *ldap.ModifyDNRequest) (err error)
- func (s *Session) ModifyWithResult(request *ldap.ModifyRequest) (*ldap.ModifyResult, error)
- func (s *Session) NTLMUnauthenticatedBind(domain, username string) error
- func (s *Session) PasswordModify(passwordModifyRequest *ldap.PasswordModifyRequest) (ret *ldap.PasswordModifyResult, err error)
- func (s *Session) Search(searchRequest *ldap.SearchRequest) (result *ldap.SearchResult, err error)
- func (s *Session) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (ret *ldap.SearchResult, err error)
- func (s *Session) SetTimeout(duration time.Duration)
- func (s *Session) SimpleBind(simpleBindRequest *ldap.SimpleBindRequest) (ret *ldap.SimpleBindResult, err error)
- func (s *Session) Start()
- func (s *Session) StartTLS(config *tls.Config) error
- func (s *Session) TLSConnectionState() (tls.ConnectionState, bool)
- func (s *Session) UnauthenticatedBind(username string) error
- func (s *Session) Unbind() error
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("pool is closed")
ErrClosed is the error resulting if the pool is closed via pool.Close().
Functions ¶
func GetAvailableObjectClass ¶
func IsLdapError ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (Client) MarshalJSON ¶
func (*Client) Options ¶
func (l *Client) Options() *LdapOptions
func (*Client) UnmarshalJSON ¶
type LdapOptions ¶
type LdapOptions struct { Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` ManagerDn string `protobuf:"bytes,2,opt,name=manager_dn,json=managerDn,proto3" json:"manager_dn,omitempty"` ManagerPassword *github_com_MicroOps_cn_fuck_safe.String `` /* 157-byte string literal not displayed */ UserSearchBase string `protobuf:"bytes,4,opt,name=user_search_base,json=userSearchBase,proto3" json:"user_search_base,omitempty"` UserSearchFilter string `protobuf:"bytes,5,opt,name=user_search_filter,json=userSearchFilter,proto3" json:"user_search_filter,omitempty"` AppSearchBase string `protobuf:"bytes,6,opt,name=app_search_base,json=appSearchBase,proto3" json:"app_search_base,omitempty"` AppSearchFilter string `protobuf:"bytes,7,opt,name=app_search_filter,json=appSearchFilter,proto3" json:"app_search_filter,omitempty"` AppObjectClass string `protobuf:"bytes,8,opt,name=app_object_class,json=appObjectClass,proto3" json:"app_object_class,omitempty"` AttrUsername string `protobuf:"bytes,9,opt,name=attr_username,json=attrUsername,proto3" json:"attr_username,omitempty"` AttrEmail string `protobuf:"bytes,10,opt,name=attr_email,json=attrEmail,proto3" json:"attr_email,omitempty"` AttrUserDisplayName string `protobuf:"bytes,11,opt,name=attr_user_display_name,json=attrUserDisplayName,proto3" json:"attr_user_display_name,omitempty"` AttrUserPhoneNo string `protobuf:"bytes,12,opt,name=attr_user_phone_no,json=attrUserPhoneNo,proto3" json:"attr_user_phone_no,omitempty"` IsTLS bool `protobuf:"varint,13,opt,name=is_tls,json=isTls,proto3" json:"is_tls,omitempty"` StartTLS bool `protobuf:"varint,14,opt,name=start_tls,json=startTls,proto3" json:"start_tls,omitempty"` TLS *github_com_MicroOps_cn_fuck_clients_tls.TLSOptions `protobuf:"bytes,15,opt,name=tls,proto3,customtype=github.com/MicroOps-cn/fuck/clients/tls.TLSOptions" json:"tls,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func NewLdapOptions ¶
func NewLdapOptions() *LdapOptions
NewLdapOptions return a default option which host field point to nowhere.
func (*LdapOptions) Descriptor ¶
func (*LdapOptions) Descriptor() ([]byte, []int)
func (*LdapOptions) GetAppObjectClass ¶
func (m *LdapOptions) GetAppObjectClass() string
func (*LdapOptions) GetAppSearchBase ¶
func (m *LdapOptions) GetAppSearchBase() string
func (*LdapOptions) GetAppSearchFilter ¶
func (m *LdapOptions) GetAppSearchFilter() string
func (*LdapOptions) GetAttrEmail ¶
func (m *LdapOptions) GetAttrEmail() string
func (*LdapOptions) GetAttrUserDisplayName ¶
func (m *LdapOptions) GetAttrUserDisplayName() string
func (*LdapOptions) GetAttrUserPhoneNo ¶
func (m *LdapOptions) GetAttrUserPhoneNo() string
func (*LdapOptions) GetAttrUsername ¶
func (m *LdapOptions) GetAttrUsername() string
func (*LdapOptions) GetHost ¶
func (m *LdapOptions) GetHost() string
func (*LdapOptions) GetIsTLS ¶
func (m *LdapOptions) GetIsTLS() bool
func (*LdapOptions) GetManagerDn ¶
func (m *LdapOptions) GetManagerDn() string
func (*LdapOptions) GetStartTLS ¶
func (m *LdapOptions) GetStartTLS() bool
func (*LdapOptions) GetUserSearchBase ¶
func (m *LdapOptions) GetUserSearchBase() string
func (*LdapOptions) GetUserSearchFilter ¶
func (m *LdapOptions) GetUserSearchFilter() string
func (*LdapOptions) ParseUserSearchFilter ¶
func (x *LdapOptions) ParseUserSearchFilter(username ...string) string
func (*LdapOptions) ProtoMessage ¶
func (*LdapOptions) ProtoMessage()
func (*LdapOptions) Reset ¶
func (m *LdapOptions) Reset()
func (*LdapOptions) String ¶
func (m *LdapOptions) String() string
func (*LdapOptions) UnmarshalJSONPB ¶
func (x *LdapOptions) UnmarshalJSONPB(unmarshaller *jsonpb.Unmarshaler, b []byte) error
func (*LdapOptions) Valid ¶
func (x *LdapOptions) Valid() error
func (*LdapOptions) XXX_DiscardUnknown ¶
func (m *LdapOptions) XXX_DiscardUnknown()
func (*LdapOptions) XXX_Marshal ¶
func (m *LdapOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*LdapOptions) XXX_Merge ¶
func (m *LdapOptions) XXX_Merge(src proto.Message)
func (*LdapOptions) XXX_Size ¶
func (m *LdapOptions) XXX_Size() int
func (*LdapOptions) XXX_Unmarshal ¶
func (m *LdapOptions) XXX_Unmarshal(b []byte) error
type Pool ¶
type Pool interface { // Get returns a new connection from the pool. Closing the connections puts // it back to the Pool. Closing it when the pool is destroyed or full will // be counted as an error. Get() (*PoolConn, error) // Close closes the pool and all its connections. After Close() the pool is // no longer usable. Close() // Len returns the current number of connections of the pool. Len() int }
Pool interface describes a pool implementation. A pool should have maximum capacity. An ideal pool is threadsafe and easy to use.
func NewChannelPool ¶
func NewChannelPool(ctx context.Context, initialCap, maxCap int, name string, factory PoolFactory, closeAt []uint16) (Pool, error)
NewChannelPool returns a new pool based on buffered channels with an initial capacity and maximum capacity. Factory is used when initial capacity is greater than zero to fill the pool. A zero initialCap doesn't fill the Pool until a new Get() is called. During a Get(), If there is no new connection available in the pool, a new connection will be created via the Factory() method.
closeAt will automagically mark the connection as unusable if the return code of the call is one of those passed, most likely you want to set this to something like []uint8{ldap.LDAPResultTimeLimitExceeded, ldap.ErrorNetwork}
func NewLdapPool ¶
func NewLdapPool(ctx context.Context, options *LdapOptions) (pool Pool, err error)
type PoolConn ¶
type PoolConn struct { Conn ldap.Client // contains filtered or unexported fields }
PoolConn implements Client to override the Close() method
func (*PoolConn) Close ¶
func (p *PoolConn) Close()
Close puts the given connects back to the pool instead of closing it.
func (*PoolConn) ExternalBind ¶
func (*PoolConn) MarkUnusable ¶
func (p *PoolConn) MarkUnusable()
MarkUnusable marks the connection not usable any more, to let the pool close it instead of returning it to pool.
func (*PoolConn) ModifyWithResult ¶
func (*PoolConn) NTLMUnauthenticatedBind ¶
func (*PoolConn) PasswordModify ¶
func (*PoolConn) SearchWithPaging ¶
func (*PoolConn) SetTimeout ¶
func (*PoolConn) SimpleBind ¶
func (*PoolConn) TLSConnectionState ¶
func (p *PoolConn) TLSConnectionState() (tls.ConnectionState, bool)
func (*PoolConn) UnauthenticatedBind ¶
type PoolFactory ¶
PoolFactory is a function to create new connections.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) ExternalBind ¶
func (*Session) ModifyWithResult ¶
func (*Session) NTLMUnauthenticatedBind ¶
func (*Session) PasswordModify ¶
func (*Session) SearchWithPaging ¶
func (*Session) SetTimeout ¶
func (*Session) SimpleBind ¶
func (*Session) TLSConnectionState ¶
func (s *Session) TLSConnectionState() (tls.ConnectionState, bool)