code: func (cl *Client) handshakesConnection(ctx context.Context, nc net.Conn, t *Torrent, encryptHeader bool, remoteAddr IpPort, network string) (c *connection, err error) {
  	c = cl.newConnection(nc, true, remoteAddr, network)
  	c.headerEncrypted = encryptHeader
  	ctx, cancel := context.WithTimeout(ctx, cl.config.HandshakesTimeout)
  	defer cancel()
  	dl, ok := ctx.Deadline()
  	if !ok {
  		panic(ctx)
  	}
  	err = nc.SetDeadline(dl)
  	if err != nil {
  		panic(err)
  	}
  	ok, err = cl.initiateHandshakes(c, t)
  	if !ok {
  		c = nil
  	}
  	return
  }
docs: // Performs initiator handshakes and returns a connection. Returns nil
  // *connection if no connection for valid reasons.