Documentation ¶
Index ¶
- Variables
- type ManagedServer
- func (s *ManagedServer) AddCredential(username string, uPSK []byte) error
- func (s *ManagedServer) Credentials() []UserCredential
- func (s *ManagedServer) DeleteCredential(username string) error
- func (s *ManagedServer) GetCredential(username string) (UserCredential, bool)
- func (s *ManagedServer) LoadFromFile() error
- func (s *ManagedServer) Start(ctx context.Context)
- func (s *ManagedServer) Stop()
- func (s *ManagedServer) UpdateCredential(username string, uPSK []byte) error
- type Manager
- func (m *Manager) LoadAll() error
- func (m *Manager) RegisterServer(name, path string, pskLength int, tcpCredStore, udpCredStore *ss2022.CredStore) (*ManagedServer, error)
- func (m *Manager) ReloadAll()
- func (m *Manager) Start(ctx context.Context) error
- func (m *Manager) Stop() error
- func (m *Manager) String() string
- type UserCredential
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyUsername = errors.New("empty username") ErrNonexistentUser = errors.New("nonexistent user") )
Functions ¶
This section is empty.
Types ¶
type ManagedServer ¶
type ManagedServer struct {
// contains filtered or unexported fields
}
ManagedServer stores information about a server whose credentials are managed by the credential manager.
func (*ManagedServer) AddCredential ¶
func (s *ManagedServer) AddCredential(username string, uPSK []byte) error
AddCredential adds a user credential.
func (*ManagedServer) Credentials ¶
func (s *ManagedServer) Credentials() []UserCredential
Credentials returns the server credentials.
func (*ManagedServer) DeleteCredential ¶
func (s *ManagedServer) DeleteCredential(username string) error
DeleteCredential deletes a user credential.
func (*ManagedServer) GetCredential ¶
func (s *ManagedServer) GetCredential(username string) (UserCredential, bool)
GetCredential returns the user credential.
func (*ManagedServer) LoadFromFile ¶
func (s *ManagedServer) LoadFromFile() error
LoadFromFile loads credentials from the configured credential file and applies the changes to the associated credential stores.
func (*ManagedServer) Start ¶
func (s *ManagedServer) Start(ctx context.Context)
Start starts the managed server.
func (*ManagedServer) UpdateCredential ¶
func (s *ManagedServer) UpdateCredential(username string, uPSK []byte) error
UpdateCredential updates a user credential.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages credentials for servers of supported protocols.
func NewManager ¶
NewManager returns a new credential manager.
func (*Manager) RegisterServer ¶
func (m *Manager) RegisterServer(name, path string, pskLength int, tcpCredStore, udpCredStore *ss2022.CredStore) (*ManagedServer, error)
RegisterServer registers a server to the manager.
func (*Manager) ReloadAll ¶
func (m *Manager) ReloadAll()
ReloadAll asks all managed servers to reload credentials from files.
type UserCredential ¶
UserCredential stores a user's credential.
func (UserCredential) Compare ¶ added in v1.8.0
func (uc UserCredential) Compare(other UserCredential) int
Compare is useful for sorting user credentials by username.