conn.go
func DialToTLS(addr string, tlsConfig *tls.Config) (*Conn, error) {

	const network = "tcp"

	if "" == addr {
		addr = "127.0.0.1:telnets"
	}

	conn, err := tls.Dial(network, addr, tlsConfig)
	if nil != err {
		return nil, err
	}

	dataReader := newDataReader(conn)
	dataWriter := newDataWriter(conn)

	clientConn := Conn{
		conn:conn,
		dataReader:dataReader,
		dataWriter:dataWriter,
	}

	return &clientConn, nil
}
func DialToTLS(addr string, tlsConfig *tls.Config) (*Conn, error) {

	const network = "tcp"

	if "" == addr {
		addr = "127.0.0.1:telnets"
	}

	conn, err := tls.Dial(network, addr, tlsConfig)
	if nil != err {
		return nil, err
	}

	dataReader := newDataReader(conn)
	dataWriter := newDataWriter(conn)

	clientConn := Conn{
		conn:conn,
		dataReader:dataReader,
		dataWriter:dataWriter,
	}

	return &clientConn, nil
}
// DialToTLS makes a (secure) TELNETS client connection to the the address specified by
// 'addr'.