diff --git a/connection.go b/connection.go index c4f8b165..471d3f59 100644 --- a/connection.go +++ b/connection.go @@ -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
blocks? fmt.Fprintf(w, "%+q: %s-%s\n", cn.PeerID, cn.localAddr(), cn.remoteAddr())