Documentation
¶
Index ¶
- Constants
- Variables
- func Advertise(peer Peer) (func(), error)
- func ConfigureCloudSync(identity *secure.Identity, directory, address, pin, owner, device string) error
- func DefaultAddress(listener net.Listener) (string, error)
- func DisableCloudSync(identity *secure.Identity, directory string) error
- func RunSync(ctx context.Context, identity *secure.Identity, directory string) error
- func SyncOnce(ctx context.Context, identity *secure.Identity, directory string) error
- type Change
- type ChangePage
- type Client
- func (c *Client) Action(ctx context.Context, id, action string, version int64) (Transfer, error)
- func (c *Client) AutomaticSend(id string, enabled bool) error
- func (c *Client) Close()
- func (c *Client) Forget(ctx context.Context, id string) error
- func (c *Client) Info(ctx context.Context) (Peer, error)
- func (c *Client) Invite(ctx context.Context) (Invitation, error)
- func (c *Client) Pair(ctx context.Context, invitation Invitation, name string) (PairRequest, error)
- func (c *Client) PairAction(ctx context.Context, id, action string) (PairRequest, error)
- func (c *Client) PairRequests(ctx context.Context) ([]PairRequest, error)
- func (c *Client) PairStatus(ctx context.Context, id string) (PairRequest, error)
- func (c *Client) Peer() Peer
- func (c *Client) PrepareFile(ctx context.Context, input string) (Transfer, error)
- func (c *Client) Remember() error
- func (c *Client) Send(ctx context.Context, id string, observe func(Transfer)) (result Transfer, resultErr error)
- func (c *Client) Transfer(ctx context.Context, id string) (Transfer, error)
- func (c *Client) Transfers(ctx context.Context) ([]Transfer, error)
- type Config
- type Invitation
- type Nearby
- type Offer
- type PairRequest
- type Peer
- type Receipt
- type ReplicatedHistory
- type Server
- type StatusError
- type StorageInfo
- type SyncTarget
- type Transfer
Constants ¶
View Source
const ChunkSize = 64 << 10
View Source
const MaxSize = int64(1) << 40
View Source
const Protocol = 1
View Source
const ServiceType = "_pinelink._tcp"
Variables ¶
View Source
var ErrConflict = errors.New("local transfer state conflict")
View Source
var ErrForbidden = errors.New("local peer is not authorized")
Functions ¶
func ConfigureCloudSync ¶
Types ¶
type ChangePage ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Pair ¶
func (c *Client) Pair(ctx context.Context, invitation Invitation, name string) (PairRequest, error)
func (*Client) PairAction ¶
func (*Client) PairRequests ¶
func (c *Client) PairRequests(ctx context.Context) ([]PairRequest, error)
func (*Client) PairStatus ¶
func (*Client) PrepareFile ¶
type Invitation ¶
type Invitation struct {
Version int `json:"version"`
Peer Peer `json:"peer"`
Token string `json:"token"`
ExpiresIn int `json:"expires_in"`
Signature string `json:"signature"`
}
func ParseInvitation ¶
func ParseInvitation(code string) (Invitation, error)
func (Invitation) Code ¶
func (i Invitation) Code() (string, error)
type Nearby ¶
type PairRequest ¶
type Peer ¶
type Peer struct {
ID string `json:"id"`
Name string `json:"name"`
SigningKey string `json:"signing_key"`
EncryptionKey string `json:"encryption_key"`
Address string `json:"address"`
Revoked bool `json:"revoked,omitempty"`
}
func ReadContact ¶
type Receipt ¶
type Receipt struct {
Version int `json:"version"`
TransferID string `json:"transfer_id"`
SenderID string `json:"sender_id"`
RecipientID string `json:"recipient_id"`
CipherRoot string `json:"cipher_root"`
PlainRoot string `json:"plaintext_root"`
PlainSize int64 `json:"plaintext_size"`
DeliveredAt time.Time `json:"delivered_at"`
Signature string `json:"signature"`
}
type ReplicatedHistory ¶
type ReplicatedHistory struct {
AuthorityRoot string `json:"authority_root"`
AggregateID string `json:"aggregate_id"`
SourceRoot string `json:"source_root"`
Kind string `json:"kind"`
Version int64 `json:"version"`
Fact json.RawMessage `json:"fact"`
}
func ReplicaHistory ¶
func ReplicaHistory(identity *secure.Identity, directory string) ([]ReplicatedHistory, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) Invite ¶
func (s *Server) Invite() (Invitation, error)
type StatusError ¶
func (*StatusError) Error ¶
func (e *StatusError) Error() string
type StorageInfo ¶
type StorageInfo struct {
DeviceID string `json:"device_id"`
StreamID string `json:"stream_id"`
Schema int `json:"schema_version"`
SQLiteVersion string `json:"sqlite_version"`
JournalMode string `json:"journal_mode"`
Synchronous int `json:"synchronous"`
LastSequence int64 `json:"last_sequence"`
UnboundOutbox int64 `json:"unbound_outbox_events"`
InboxFacts int64 `json:"inbox_facts"`
Integrity string `json:"integrity"`
}
type SyncTarget ¶
type SyncTarget struct {
Target string `json:"target"`
Kind string `json:"kind"`
Address string `json:"address"`
Pin string `json:"pin"`
Owner string `json:"owner_id"`
Device string `json:"device_id"`
Enabled bool `json:"enabled"`
Uploaded int64 `json:"uploaded_sequence"`
Epoch string `json:"pulled_epoch"`
Pulled int64 `json:"pulled_sequence"`
Bootstrapped bool `json:"bootstrapped"`
SnapshotUpper int64 `json:"snapshot_upper"`
SnapshotKey string `json:"snapshot_key"`
RosterVersion int64 `json:"roster_version"`
RosterHash string `json:"roster_hash"`
PendingRoster []byte `json:"-"`
Failures int `json:"failures"`
Next *string `json:"next_attempt_at,omitempty"`
LastError string `json:"last_error,omitempty"`
LastSuccess *string `json:"last_success_at,omitempty"`
BoundEpoch string `json:"bound_epoch"`
}
func SyncStatus ¶
func SyncStatus(identity *secure.Identity, directory string) ([]SyncTarget, error)
type Transfer ¶
type Transfer struct {
SampleAgeMillis int64 `json:"sample_age_ms"`
Offer
PeerID string `json:"peer_id"`
FileName string `json:"file_name"`
PlainSize int64 `json:"plaintext_size"`
PlainRoot string `json:"plaintext_root"`
State string `json:"state"`
Version int64 `json:"state_version"`
Acknowledged int64 `json:"acknowledged_bytes"`
Revision int64 `json:"progress_revision"`
SampledAt *time.Time `json:"sampled_at,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
RemainingMillis int64 `json:"remaining_ms"`
Route string `json:"route"`
Transport string `json:"transport"`
Authority string `json:"authority"`
AuthorityID string `json:"authority_device_id"`
SpoolState string `json:"spool_state"`
Receipt *Receipt `json:"receipt,omitempty"`
OutputName string `json:"output_name,omitempty"`
Direction string `json:"direction"`
Error string `json:"error,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.