diff --git a/server/auth.go b/server/auth.go index 413d8da0..d8a6fdd1 100644 --- a/server/auth.go +++ b/server/auth.go @@ -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 diff --git a/server/client.go b/server/client.go index 9fa75efa..83435241 100644 --- a/server/client.go +++ b/server/client.go @@ -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 {