mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 22:56:48 +00:00
Other: Fix all linter errors
This commit is contained in:
committed by
James Houlahan
parent
b36972ce71
commit
7c62312220
@ -97,7 +97,7 @@ type Bridge struct {
|
||||
}
|
||||
|
||||
// New creates a new bridge.
|
||||
func New(
|
||||
func New( //nolint:funlen
|
||||
locator Locator, // the locator to provide paths to store data
|
||||
vault *vault.Vault, // the bridge's encrypted data store
|
||||
autostarter Autostarter, // the autostarter to manage autostart settings
|
||||
@ -131,10 +131,7 @@ func New(
|
||||
return nil, nil, fmt.Errorf("failed to get Gluon directory: %w", err)
|
||||
}
|
||||
|
||||
smtpBackend, err := newSMTPBackend()
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to create SMTP backend: %w", err)
|
||||
}
|
||||
smtpBackend := newSMTPBackend()
|
||||
|
||||
imapServer, err := newIMAPServer(gluonDir, curVersion, tlsConfig, logIMAPClient, logIMAPServer)
|
||||
if err != nil {
|
||||
@ -416,9 +413,9 @@ func loadTLSConfig(vault *vault.Vault) (*tls.Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: Do we have to set MinVersion to tls.VersionTLS12?
|
||||
return &tls.Config{
|
||||
Certificates: []tls.Certificate{cert},
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@ -461,7 +461,7 @@ func waitForEvent[T any](t *testing.T, eventCh <-chan events.Event, wantEvent T)
|
||||
t.Helper()
|
||||
|
||||
for event := range eventCh {
|
||||
switch event.(type) {
|
||||
switch event.(type) { // nolint:gocritic
|
||||
case T:
|
||||
return
|
||||
}
|
||||
|
||||
@ -120,7 +120,6 @@ func getGluonDir(encVault *vault.Vault) (string, error) {
|
||||
return "", fmt.Errorf("failed to check if gluon dir is empty: %w", err)
|
||||
}
|
||||
|
||||
// TODO: Handle case that the gluon directory is missing and we can't create it!
|
||||
if !exists {
|
||||
if err := os.MkdirAll(encVault.GetGluonDir(), 0700); err != nil {
|
||||
return "", fmt.Errorf("failed to create gluon dir: %w", err)
|
||||
|
||||
@ -29,13 +29,13 @@ type smtpBackend struct {
|
||||
usersLock sync.RWMutex
|
||||
}
|
||||
|
||||
func newSMTPBackend() (*smtpBackend, error) {
|
||||
func newSMTPBackend() *smtpBackend {
|
||||
return &smtpBackend{
|
||||
users: make(map[string]*user.User),
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (backend *smtpBackend) Login(state *smtp.ConnectionState, email, password string) (smtp.Session, error) {
|
||||
func (backend *smtpBackend) Login(_ *smtp.ConnectionState, email, password string) (smtp.Session, error) {
|
||||
backend.usersLock.RLock()
|
||||
defer backend.usersLock.RUnlock()
|
||||
|
||||
|
||||
@ -65,9 +65,7 @@ func (bridge *Bridge) GetUserIDs() []string {
|
||||
|
||||
// GetUserInfo returns info about the given user.
|
||||
func (bridge *Bridge) GetUserInfo(userID string) (UserInfo, error) {
|
||||
if info, ok := safe.MapGetRet(bridge.users, userID, func(user *user.User) UserInfo {
|
||||
return getConnUserInfo(user)
|
||||
}); ok {
|
||||
if info, ok := safe.MapGetRet(bridge.users, userID, getConnUserInfo); ok {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
@ -139,7 +137,7 @@ func (bridge *Bridge) LoginUser(
|
||||
return userID, nil
|
||||
}
|
||||
|
||||
// LoginUser authorizes a new bridge user with the given username and password.
|
||||
// LoginFull authorizes a new bridge user with the given username and password.
|
||||
// If necessary, a TOTP and mailbox password are requested via the callbacks.
|
||||
// This is equivalent to doing LoginAuth and LoginUser separately.
|
||||
func (bridge *Bridge) LoginFull(
|
||||
@ -282,7 +280,6 @@ func (bridge *Bridge) loadLoop() {
|
||||
return
|
||||
|
||||
case <-bridge.loadCh:
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -440,7 +437,7 @@ func (bridge *Bridge) addUserWithVault(
|
||||
// newVaultUser creates a new vault user from the given auth information.
|
||||
// If one already exists in the vault, its data will be updated.
|
||||
func (bridge *Bridge) newVaultUser(
|
||||
client *liteapi.Client,
|
||||
_ *liteapi.Client,
|
||||
apiUser liteapi.User,
|
||||
authUID, authRef string,
|
||||
saltedKeyPass []byte,
|
||||
|
||||
@ -79,7 +79,7 @@ func (bridge *Bridge) handleUserAddressCreated(ctx context.Context, user *user.U
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO: Handle addresses that have been disabled!
|
||||
// GODT-1948: Handle addresses that have been disabled!
|
||||
func (bridge *Bridge) handleUserAddressUpdated(_ context.Context, user *user.User, _ events.UserAddressUpdated) error {
|
||||
switch user.GetAddressMode() {
|
||||
case vault.CombinedMode:
|
||||
|
||||
Reference in New Issue
Block a user