mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-21 15:59:26 +08:00
support auth
This commit is contained in:
@@ -20,6 +20,9 @@ type Connection struct {
|
||||
|
||||
// subscribing channels
|
||||
subs map[string]bool
|
||||
|
||||
// password may be changed by CONFIG command during runtime, so store the password
|
||||
password string
|
||||
}
|
||||
|
||||
// RemoteAddr returns the remote network address
|
||||
@@ -97,6 +100,14 @@ func (c *Connection) GetChannels() []string {
|
||||
return channels
|
||||
}
|
||||
|
||||
func (c *Connection) SetPassword(password string) {
|
||||
c.password = password
|
||||
}
|
||||
|
||||
func (c *Connection) GetPassword() string {
|
||||
return c.password
|
||||
}
|
||||
|
||||
type FakeConn struct {
|
||||
Connection
|
||||
buf bytes.Buffer
|
||||
@@ -113,4 +124,4 @@ func (c *FakeConn) Clean() {
|
||||
|
||||
func (c *FakeConn) Bytes() []byte {
|
||||
return c.buf.Bytes()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user