Skip to content

Commit

Permalink
Replace closable interface by io.Closer
Browse files Browse the repository at this point in the history
There is no need to define a custom interface.
  • Loading branch information
stv0g committed Feb 10, 2023
1 parent 359f068 commit 583ad44
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"errors"
"fmt"
"io"
"net"
"reflect"
"sync"
Expand All @@ -20,12 +21,8 @@ const (
stunGatherTimeout = time.Second * 5
)

type closeable interface {
Close() error
}

// Close a net.Conn and log if we have a failure
func closeConnAndLog(c closeable, log logging.LeveledLogger, msg string) {
func closeConnAndLog(c io.Closer, log logging.LeveledLogger, msg string) {
if c == nil || (reflect.ValueOf(c).Kind() == reflect.Ptr && reflect.ValueOf(c).IsNil()) {
log.Warnf("Conn is not allocated (%s)", msg)
return
Expand Down

0 comments on commit 583ad44

Please sign in to comment.