mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 19:56:51 +08:00
34 lines
469 B
Go
34 lines
469 B
Go
package adapters
|
|
|
|
import (
|
|
"bufio"
|
|
"net"
|
|
|
|
C "github.com/Dreamacro/clash/constant"
|
|
)
|
|
|
|
type HttpsAdapter struct {
|
|
addr *C.Addr
|
|
conn net.Conn
|
|
rw *bufio.ReadWriter
|
|
}
|
|
|
|
func (h *HttpsAdapter) Close() {
|
|
h.conn.Close()
|
|
}
|
|
|
|
func (h *HttpsAdapter) Addr() *C.Addr {
|
|
return h.addr
|
|
}
|
|
|
|
func (h *HttpsAdapter) Conn() net.Conn {
|
|
return h.conn
|
|
}
|
|
|
|
func NewHttps(host string, conn net.Conn) *HttpsAdapter {
|
|
return &HttpsAdapter{
|
|
addr: parseHttpAddr(host),
|
|
conn: conn,
|
|
}
|
|
}
|