func (c *Conn) Close() {
	if c.h2c != nil {
		c.h2c.Close()
	}
	if c.conn != nil {
		c.conn.Close()
	}
}
Close will close the underlying connections. After this is called, the struct is no
longer safe to use
package h2csmuggler
import (
	"context"
	"crypto/tls"
	"fmt"
	"io"
	"net"
	"net/http"
	"net/url"
	"sync"
	"time"
	"github.com/minight/h2csmuggler/http2"
	log "github.com/sirupsen/logrus"
	"github.com/pkg/errors"
)
var (
	DefaultDialer = &net.Dialer{
		Timeout: time.Millisecond * time.Duration(5000),
		Resolver: &net.Resolver{
			PreferGo: true,
			Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
				d := net.Dialer{
					Timeout: time.Millisecond * time.Duration(5000),
				}
				return d.DialContext(ctx, "udp", "1.1.1.1:53")
			},
		},
	}
	DefaultTransport = &http2.Transport{
		AllowHTTP: true,
	}
)
type ConnectionOption func(c *Conn)
func ConnectionTransport(t *http2.Transport) ConnectionOption {
	return func(c *Conn) {
		c.transport = t
	}
}
func ConnectionDialer(t *net.Dialer) ConnectionOption {
	return func(c *Conn) {
		c.dialer = t
	}
}
func ConnectionMaxRetries(v int) ConnectionOption {
	return func(c *Conn) {
		c.maxRetries = v
	}
}
func NewConn(target string, opts ...ConnectionOption) (*Conn, error) {
	var err error
	var c Conn = Conn{
		dialer:    DefaultDialer,
		transport: DefaultTransport,
	}
	c.url, err = url.Parse(target)
	if err != nil {
		return nil, err
	}
	for _, o := range opts {
		o(&c)
	}
	return &c, nil
}
type Conn struct {
	url        *url.URL
	dialer     *net.Dialer
	transport  *http2.Transport
	maxRetries int
	conn net.Conn
	h2c  *http2.ClientConn
	init   bool
	initmu sync.RWMutex
}
func (c *Conn) Initialized() bool {
	c.initmu.RLock()
	defer c.initmu.RUnlock()
	return c.init
}
func (c *Conn) setInitialized() {
	log.WithField("url", c.url).Tracef("setting initialized for conn")
	c.initmu.Lock()
	defer c.initmu.Unlock()
	c.init = true
	log.WithField("url", c.url).Tracef("initilzied set")
}