Implement Stringer on connection
This commit is contained in:
parent
c41aa941f3
commit
58dd6ddf93
|
@ -2,6 +2,7 @@ package torrent
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"container/list"
|
||||
"encoding"
|
||||
"errors"
|
||||
|
@ -234,6 +235,12 @@ func (cn *connection) statusFlags() (ret string) {
|
|||
return
|
||||
}
|
||||
|
||||
func (cn *connection) String() string {
|
||||
var buf bytes.Buffer
|
||||
cn.WriteStatus(&buf, nil)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (cn *connection) WriteStatus(w io.Writer, t *torrent) {
|
||||
// \t isn't preserved in <pre> blocks?
|
||||
fmt.Fprintf(w, "%+q: %s-%s\n", cn.PeerID, cn.localAddr(), cn.remoteAddr())
|
||||
|
|
Loading…
Reference in New Issue