-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.go
40 lines (33 loc) · 1021 Bytes
/
base.go
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
31
32
33
34
35
36
37
38
39
40
// Copyright 2015 Keybase, Inc. All rights reserved. Use of
// this source code is governed by the included BSD license.
package kex2
import (
"errors"
"net"
"time"
keybase1 "github.com/keybase/client/go/protocol/keybase1"
"github.com/keybase/go-framed-msgpack-rpc/rpc"
"golang.org/x/net/context"
)
type LogContext interface {
Debug(format string, args ...interface{})
}
type baseDevice struct {
conn net.Conn
xp rpc.Transporter
deviceID DeviceID
start chan struct{}
canceled bool
}
// KexBaseArg are arguments common to both Provisioner and Provisionee
type KexBaseArg struct {
Ctx context.Context
LogCtx LogContext
Mr MessageRouter
Secret Secret
DeviceID keybase1.DeviceID // For now, this deviceID is different from the one in the transport
SecretChannel <-chan Secret
Timeout time.Duration
}
// ErrCanceled is returned if Kex is canceled by the caller via the Context argument
var ErrCanceled = errors.New("kex canceled by caller")