refactor: format code and add more constants
Some checks failed
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 12s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 51s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 49s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 49s
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 57s
Go Build Multi-Platform / build (arm, windows) (push) Failing after 19s
Go Build Multi-Platform / build (arm, linux) (push) Failing after 21s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 44s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 48s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 47s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 46s
Run Gosec / tests (push) Successful in 45s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Revive Lint / lint (push) Successful in 9m48s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 19m13s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 19m19s
Some checks failed
Go Build Multi-Platform / build (amd64, darwin) (push) Failing after 12s
Go Build Multi-Platform / build (amd64, freebsd) (push) Successful in 51s
Go Build Multi-Platform / build (amd64, linux) (push) Successful in 49s
Go Build Multi-Platform / build (arm, freebsd) (push) Successful in 49s
Go Build Multi-Platform / build (amd64, windows) (push) Successful in 57s
Go Build Multi-Platform / build (arm, windows) (push) Failing after 19s
Go Build Multi-Platform / build (arm, linux) (push) Failing after 21s
Go Build Multi-Platform / build (arm64, darwin) (push) Successful in 44s
Go Build Multi-Platform / build (arm64, freebsd) (push) Successful in 48s
Go Build Multi-Platform / build (arm64, linux) (push) Successful in 47s
Go Build Multi-Platform / build (arm64, windows) (push) Successful in 46s
Run Gosec / tests (push) Successful in 45s
Go Build Multi-Platform / Create Release (push) Has been skipped
Go Revive Lint / lint (push) Successful in 9m48s
Go Test Multi-Platform / Test (ubuntu-latest, arm64) (push) Successful in 19m13s
Go Test Multi-Platform / Test (ubuntu-latest, amd64) (push) Successful in 19m19s
This commit is contained in:
@@ -13,13 +13,13 @@ import (
|
||||
)
|
||||
|
||||
type Manager struct {
|
||||
basePath string
|
||||
ratchetsPath string
|
||||
identitiesPath string
|
||||
destinationTable string
|
||||
knownDestinations string
|
||||
transportIdentity string
|
||||
mutex sync.RWMutex
|
||||
basePath string
|
||||
ratchetsPath string
|
||||
identitiesPath string
|
||||
destinationTable string
|
||||
knownDestinations string
|
||||
transportIdentity string
|
||||
mutex sync.RWMutex
|
||||
}
|
||||
|
||||
type RatchetData struct {
|
||||
@@ -34,14 +34,14 @@ func NewManager() (*Manager, error) {
|
||||
}
|
||||
|
||||
basePath := filepath.Join(homeDir, ".reticulum-go", "storage")
|
||||
|
||||
|
||||
m := &Manager{
|
||||
basePath: basePath,
|
||||
ratchetsPath: filepath.Join(basePath, "ratchets"),
|
||||
identitiesPath: filepath.Join(basePath, "identities"),
|
||||
destinationTable: filepath.Join(basePath, "destination_table"),
|
||||
knownDestinations: filepath.Join(basePath, "known_destinations"),
|
||||
transportIdentity: filepath.Join(basePath, "transport_identity"),
|
||||
basePath: basePath,
|
||||
ratchetsPath: filepath.Join(basePath, "ratchets"),
|
||||
identitiesPath: filepath.Join(basePath, "identities"),
|
||||
destinationTable: filepath.Join(basePath, "destination_table"),
|
||||
knownDestinations: filepath.Join(basePath, "known_destinations"),
|
||||
transportIdentity: filepath.Join(basePath, "transport_identity"),
|
||||
}
|
||||
|
||||
if err := m.initializeDirectories(); err != nil {
|
||||
@@ -76,7 +76,7 @@ func (m *Manager) SaveRatchet(identityHash []byte, ratchetKey []byte) error {
|
||||
|
||||
hexHash := hex.EncodeToString(identityHash)
|
||||
ratchetDir := filepath.Join(m.ratchetsPath, hexHash)
|
||||
|
||||
|
||||
if err := os.MkdirAll(ratchetDir, 0700); err != nil {
|
||||
return fmt.Errorf("failed to create ratchet directory: %w", err)
|
||||
}
|
||||
@@ -186,4 +186,3 @@ func (m *Manager) GetDestinationTablePath() string {
|
||||
func (m *Manager) GetKnownDestinationsPath() string {
|
||||
return m.knownDestinations
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user