mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-14 04:07:46 +00:00
* Add redis support for distributed caching * Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * fixup! fixup! fixup! fixup! fixup! Move towards the self-provided Redis connection pool and RESP protocol implementation. Official redis client library won't work with yaegi. * ... and another all nighter. * fixup! ... and another all nighter. * fixup! fixup! ... and another all nighter. * fixup! fixup! fixup! ... and another all nighter. * Resolve issue #85 by adding ability to set custom claims in JWT tokens * Remove redundant validation in auth middleware ( issue #89 ) * Add ability to set cookie prefix for session cookies ( #87 ) * fixup! Add ability to set cookie prefix for session cookies ( #87 ) * Add ability to set cookie max age - issue #91 * Potential fix for code scanning alert no. 10: Size computation for allocation may overflow Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fixup! Merge main into 0.8.0-redis: resolve conflicts --------- Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
61 lines
916 B
Go
61 lines
916 B
Go
package proto
|
|
|
|
import (
|
|
"bufio"
|
|
"crypto/tls"
|
|
"net"
|
|
)
|
|
|
|
type Client struct {
|
|
c net.Conn
|
|
r *bufio.Reader
|
|
}
|
|
|
|
func Dial(addr string) (*Client, error) {
|
|
c, err := net.Dial("tcp", addr)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &Client{
|
|
c: c,
|
|
r: bufio.NewReader(c),
|
|
}, nil
|
|
}
|
|
|
|
func DialTLS(addr string, cfg *tls.Config) (*Client, error) {
|
|
c, err := tls.Dial("tcp", addr, cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &Client{
|
|
c: c,
|
|
r: bufio.NewReader(c),
|
|
}, nil
|
|
}
|
|
|
|
func (c *Client) Close() error {
|
|
return c.c.Close()
|
|
}
|
|
|
|
func (c *Client) Do(cmd ...string) (string, error) {
|
|
if err := Write(c.c, cmd); err != nil {
|
|
return "", err
|
|
}
|
|
return Read(c.r)
|
|
}
|
|
|
|
func (c *Client) Read() (string, error) {
|
|
return Read(c.r)
|
|
}
|
|
|
|
// Do() + ReadStrings()
|
|
func (c *Client) DoStrings(cmd ...string) ([]string, error) {
|
|
res, err := c.Do(cmd...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return ReadStrings(res)
|
|
}
|