github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kex2/base.go (about)

     1  // Copyright 2015 Keybase, Inc. All rights reserved. Use of
     2  // this source code is governed by the included BSD license.
     3  
     4  package kex2
     5  
     6  import (
     7  	"errors"
     8  	"net"
     9  	"time"
    10  
    11  	keybase1 "github.com/keybase/client/go/protocol/keybase1"
    12  	"github.com/keybase/go-framed-msgpack-rpc/rpc"
    13  	"golang.org/x/net/context"
    14  )
    15  
    16  type LogContext interface {
    17  	Debug(format string, args ...interface{})
    18  }
    19  
    20  type baseDevice struct {
    21  	conn     net.Conn        //nolint
    22  	xp       rpc.Transporter //nolint
    23  	deviceID DeviceID        //nolint
    24  	start    chan struct{}
    25  	canceled bool //nolint
    26  }
    27  
    28  // KexBaseArg are arguments common to both Provisioner and Provisionee
    29  type KexBaseArg struct {
    30  	Ctx           context.Context
    31  	LogCtx        LogContext
    32  	Mr            MessageRouter
    33  	Secret        Secret
    34  	DeviceID      keybase1.DeviceID // For now, this deviceID is different from the one in the transport
    35  	SecretChannel <-chan Secret
    36  	Timeout       time.Duration
    37  }
    38  
    39  // ErrCanceled is returned if Kex is canceled by the caller via the Context argument
    40  var ErrCanceled = errors.New("kex canceled by caller")