Skip to content

Commit

Permalink
Avoid concrete net.Dialer type for easier mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
kubuzetto committed Feb 8, 2024
1 parent aad5700 commit bf1b8cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pop3.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// Client implements a Client e-mail client.
type Client struct {
opt Opt
dialer *net.Dialer
dialer Dialer
}

// Conn is a stateful connection with the POP3 server/
Expand All @@ -35,12 +35,16 @@ type Opt struct {

// Default is 3 seconds.
DialTimeout time.Duration `json:"dial_timeout"`
Dialer *net.Dialer `json:"-"`
Dialer Dialer `json:"-"`

TLSEnabled bool `json:"tls_enabled"`
TLSSkipVerify bool `json:"tls_skip_verify"`
}

type Dialer interface {
Dial(network, address string) (net.Conn, error)
}

// MessageID contains the ID and size of an individual message.
type MessageID struct {
// ID is the numerical index (non-unique) of the message.
Expand Down

0 comments on commit bf1b8cf

Please # to comment.