Skip to content

Commit

Permalink
Added type for DialFunc
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Nov 27, 2014
1 parent a99a58b commit 19eb4d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
// Client is a client of a waddell server
type Client struct {
// Dial is a function that dials the waddell server
Dial func() (net.Conn, error)
Dial DialFunc

// ReconnectAttempts specifies how many consecutive times to try
// reconnecting in the event of a connection failure.
Expand All @@ -42,6 +42,8 @@ type Client struct {
closed int32
}

type DialFunc func() (net.Conn, error)

// Connect starts the waddell client and establishes an initial connection to
// the waddell server, returning the initial PeerId.
//
Expand All @@ -65,7 +67,7 @@ func (c *Client) Connect() (PeerId, error) {

// Secured wraps the given dial function with TLS support, authenticating the
// waddell server using the supplied cert (assumed to be PEM encoded).
func Secured(dial func() (net.Conn, error), cert string) (func() (net.Conn, error), error) {
func Secured(dial DialFunc, cert string) (DialFunc, error) {
c, err := keyman.LoadCertificateFromPEMBytes([]byte(cert))
if err != nil {
return nil, err
Expand Down

0 comments on commit 19eb4d5

Please sign in to comment.