48 lines
1.9 KiB
Go
48 lines
1.9 KiB
Go
|
|
/*
|
||
|
|
* Copyright (c) 2026 Kaiy Ragur
|
||
|
|
*
|
||
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||
|
|
*/
|
||
|
|
package remote
|
||
|
|
|
||
|
|
import (
|
||
|
|
"crypto/ed25519"
|
||
|
|
"io"
|
||
|
|
|
||
|
|
"github.com/neilalexander/yggmail/internal/account"
|
||
|
|
"github.com/neilalexander/yggmail/internal/remote"
|
||
|
|
pb "github.com/neilalexander/yggmail/internal/remote/types"
|
||
|
|
"github.com/neilalexander/yggmail/internal/storage"
|
||
|
|
"github.com/neilalexander/yggmail/internal/storage/types"
|
||
|
|
"github.com/neilalexander/yggmail/internal/transport"
|
||
|
|
)
|
||
|
|
|
||
|
|
type RemoteStorage struct {
|
||
|
|
Client *remote.Client
|
||
|
|
targetNode ed25519.PublicKey
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewRemoteStorage(targetNode ed25519.PublicKey, sess *account.Session, tr transport.Transport) storage.Storage {
|
||
|
|
return &RemoteStorage{
|
||
|
|
Client: remote.NewClient(sess.Publickey(), sess.Sign, tr),
|
||
|
|
targetNode: targetNode,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (s *RemoteStorage) Call(req *pb.Request, r io.ReadCloser, size uint32) (*pb.Response, *remote.Payload, error) {
|
||
|
|
return s.Client.Call(s.targetNode, req, r, size)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (s *RemoteStorage) ConfigGet(k string) (string, error) { return "", nil }
|
||
|
|
func (s *RemoteStorage) ConfigSet(k, v string) error { return nil }
|
||
|
|
func (s *RemoteStorage) ConfigSetPassword(p string) error { return nil }
|
||
|
|
func (s *RemoteStorage) ConfigTryPassword(p string) (bool, error) { return false, nil }
|
||
|
|
|
||
|
|
func (s *RemoteStorage) AccountTryPassword(pk, p string) (bool, error) { return false, nil }
|
||
|
|
func (s *RemoteStorage) AccountGet(pk string) (*types.Account, error) { return nil, nil }
|
||
|
|
func (s *RemoteStorage) AccountList() ([]*types.Account, error) { return nil, nil }
|
||
|
|
func (s *RemoteStorage) AccountCreate(acc *types.Account) error { return nil }
|
||
|
|
func (s *RemoteStorage) AccountDelete(pk string) error { return nil }
|