mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Merge pull request #2084 from ripienaar/client_auth_kind
expose the connection kind to CustomClientAuthentication
This commit is contained in:
@@ -47,6 +47,8 @@ type ClientAuthentication interface {
|
||||
RegisterUser(*User)
|
||||
// RemoteAddress expose the connection information of the client
|
||||
RemoteAddress() net.Addr
|
||||
// Kind indicates what type of connection this is matching defined constants like CLIENT, ROUTER, GATEWAY, LEAF etc
|
||||
Kind() int
|
||||
}
|
||||
|
||||
// NkeyUser is for multiple nkey based users
|
||||
|
||||
@@ -643,6 +643,15 @@ func (c *client) reportErrRegisterAccount(acc *Account, err error) {
|
||||
c.sendErr("Failed Account Registration")
|
||||
}
|
||||
|
||||
// Kind returns the client kind and will be one of the defined constants like CLIENT, ROUTER, GATEWAY, LEAF
|
||||
func (c *client) Kind() int {
|
||||
c.mu.Lock()
|
||||
kind := c.kind
|
||||
c.mu.Unlock()
|
||||
|
||||
return kind
|
||||
}
|
||||
|
||||
// registerWithAccount will register the given user with a specific
|
||||
// account. This will change the subject namespace.
|
||||
func (c *client) registerWithAccount(acc *Account) error {
|
||||
|
||||
Reference in New Issue
Block a user