mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
subservers: add Handles method
Add a Handles method to the subserver Manager which takes a URI string and returns true if one of the sub-servers it manages owns the given URI.
This commit is contained in:
parent
3769467c24
commit
21456a5887
1 changed files with 17 additions and 0 deletions
|
|
@ -300,6 +300,23 @@ func (s *Manager) ReadRemoteMacaroon(uri string) (bool, []byte, error) {
|
|||
return false, nil, nil
|
||||
}
|
||||
|
||||
// Handles returns true if one of its sub-servers owns the given URI along with
|
||||
// the name of the service.
|
||||
func (s *Manager) Handles(uri string) (bool, string) {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
|
||||
for _, ss := range s.servers {
|
||||
if !s.permsMgr.IsSubServerURI(ss.Name(), uri) {
|
||||
continue
|
||||
}
|
||||
|
||||
return true, ss.Name()
|
||||
}
|
||||
|
||||
return false, ""
|
||||
}
|
||||
|
||||
// Stop stops all the manager's sub-servers
|
||||
func (s *Manager) Stop() error {
|
||||
var returnErr error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue