-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconnect.go
More file actions
30 lines (24 loc) · 816 Bytes
/
connect.go
File metadata and controls
30 lines (24 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package payd
import (
"context"
validator "github.com/theflyingcodr/govalidator"
)
// ConnectArgs identify the invoiceId / channelID to connect to.
type ConnectArgs struct {
InvoiceID string `param:"invoiceId"`
}
// Validate will check that invoice arguments match expectations.
func (c *ConnectArgs) Validate() error {
return validator.New().
Validate("invoiceID", validator.StrLength(c.InvoiceID, 1, 30)).
Err()
}
// ConnectService is used to connect this wallet to an async channel server, this could be sockets, peer channels
// or something else.
type ConnectService interface {
Connect(ctx context.Context, args ConnectArgs) error
}
// ConnectWriter handles data writes when creating a new async connection.
type ConnectWriter interface {
Connect(ctx context.Context, args ConnectArgs) error
}