github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/p2p/conn/conn_notgo110.go (about) 1 //go:build !go1.10 2 3 package conn 4 5 import ( 6 "net" 7 "time" 8 ) 9 10 // Only Go1.10 has a proper net.Conn implementation that 11 // has the SetDeadline method implemented as per 12 // 13 // https://github.com/golang/go/commit/e2dd8ca946be884bb877e074a21727f1a685a706 14 // 15 // lest we run into problems like 16 // 17 // https://github.com/tendermint/classic/issues/851 18 // 19 // so for go versions < Go1.10 use our custom net.Conn creator 20 // that doesn't return an `Unimplemented error` for net.Conn. 21 // Before https://github.com/tendermint/classic/commit/49faa79bdce5663894b3febbf4955fb1d172df04 22 // we hadn't cared about errors from SetDeadline so swallow them up anyways. 23 type pipe struct { 24 net.Conn 25 } 26 27 func (p *pipe) SetDeadline(t time.Time) error { 28 return nil 29 } 30 31 func NetPipe() (net.Conn, net.Conn) { 32 p1, p2 := net.Pipe() 33 return &pipe{p1}, &pipe{p2} 34 } 35 36 var _ net.Conn = (*pipe)(nil)