Skip to content

Commit

Permalink
Chore: sync necessary changes from premium
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamacro committed Sep 21, 2020
1 parent 10f9571 commit 8766287
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion common/cache/lrucache.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (c *LruCache) get(key interface{}) *entry {
}

// Delete removes the value associated with a key.
func (c *LruCache) Delete(key string) {
func (c *LruCache) Delete(key interface{}) {
c.mu.Lock()

if le, ok := c.cache[key]; ok {
Expand Down
2 changes: 1 addition & 1 deletion component/fakeip/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func ipToUint(ip net.IP) uint32 {
}

func uintToIP(v uint32) net.IP {
return net.IPv4(byte(v>>24), byte(v>>16), byte(v>>8), byte(v))
return net.IP{byte(v >> 24), byte(v >> 16), byte(v >> 8), byte(v)}
}

// New return Pool instance
Expand Down
13 changes: 6 additions & 7 deletions tunnel/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (
"strings"
"time"

adapters "github.com/Dreamacro/clash/adapters/inbound"
"github.com/Dreamacro/clash/adapters/inbound"
"github.com/Dreamacro/clash/common/pool"
"github.com/Dreamacro/clash/component/resolver"
C "github.com/Dreamacro/clash/constant"

"github.com/Dreamacro/clash/common/pool"
)

func handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
func handleHTTP(request *inbound.HTTPAdapter, outbound net.Conn) {
req := request.R
host := req.Host

Expand All @@ -28,7 +27,7 @@ func handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {

req.Header.Set("Connection", "close")
req.RequestURI = ""
adapters.RemoveHopByHopHeaders(req.Header)
inbound.RemoveHopByHopHeaders(req.Header)
err := req.Write(outbound)
if err != nil {
break
Expand All @@ -39,7 +38,7 @@ func handleHTTP(request *adapters.HTTPAdapter, outbound net.Conn) {
if err != nil {
break
}
adapters.RemoveHopByHopHeaders(resp.Header)
inbound.RemoveHopByHopHeaders(resp.Header)

if resp.StatusCode == http.StatusContinue {
err = resp.Write(request)
Expand Down Expand Up @@ -128,7 +127,7 @@ func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, fAddr n
}
}

func handleSocket(request *adapters.SocketAdapter, outbound net.Conn) {
func handleSocket(request C.ServerAdapter, outbound net.Conn) {
relay(request, outbound)
}

Expand Down

0 comments on commit 8766287

Please sign in to comment.