-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* support both http chunked and pull * fix http: multiple response.WriteHeader calls * fix github path * [skip ci] add test * add more test * [skip ci] add http version header
- Loading branch information
Showing
16 changed files
with
353 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package cracker | ||
|
||
import ( | ||
"io" | ||
"strings" | ||
"time" | ||
) | ||
|
||
type Handler struct { | ||
Server string | ||
Secret string | ||
Interval time.Duration | ||
} | ||
|
||
func (h *Handler) Connect(addr string) (io.ReadWriteCloser, error) { | ||
if strings.HasSuffix(h.Server, "/") { | ||
h.Server = h.Server[:len(h.Server)-1] | ||
} | ||
conn := &localProxyConn{server: h.Server, secret: h.Secret, interval: h.Interval} | ||
host := strings.Split(addr, ":")[0] | ||
port := strings.Split(addr, ":")[1] | ||
uuid, err := conn.connect(host, port) | ||
if err != nil { | ||
return nil, err | ||
} | ||
conn.uuid = uuid | ||
if h.Interval == 0 { | ||
err = conn.pull() | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
conn.close = make(chan bool) | ||
go conn.alive() | ||
return conn, nil | ||
} | ||
|
||
func (h *Handler) Clean() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package proxy | ||
package cracker | ||
|
||
import ( | ||
"crypto/hmac" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package proxy | ||
package cracker | ||
|
||
import ( | ||
"testing" | ||
|
Oops, something went wrong.