mirror of
https://github.com/xvzc/SpoofDPI.git
synced 2024-12-22 14:26:31 +00:00
add https request
This commit is contained in:
parent
81938445a1
commit
b615f4aabc
@ -38,7 +38,7 @@ func Start() {
|
||||
|
||||
util.Debug("Client sent data: ", len(b))
|
||||
|
||||
r := request.New(&b)
|
||||
r := request.NewHttpRequest(&b)
|
||||
|
||||
if !r.IsValidMethod() {
|
||||
log.Println("Unsupported method: ", r.Method)
|
||||
|
@ -4,13 +4,21 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
type HttpRequest struct {
|
||||
Raw *[]byte
|
||||
Method string
|
||||
Domain string
|
||||
}
|
||||
|
||||
func (r *Request) IsValidMethod() bool {
|
||||
func NewHttpRequest(raw *[]byte) HttpRequest {
|
||||
return HttpRequest{
|
||||
Raw: raw,
|
||||
Method: extractMethod(raw),
|
||||
Domain: extractDomain(raw),
|
||||
}
|
||||
}
|
||||
|
||||
func (r *HttpRequest) IsValidMethod() bool {
|
||||
if _, exists := getValidMethods()[r.Method]; exists {
|
||||
return true
|
||||
}
|
||||
@ -18,15 +26,7 @@ func (r *Request) IsValidMethod() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func New(raw *[]byte) Request {
|
||||
return Request{
|
||||
Raw: raw,
|
||||
Method: extractMethod(raw),
|
||||
Domain: extractDomain(raw),
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Request) ToChunks() {
|
||||
func (r *HttpRequest) ToChunks() {
|
||||
|
||||
}
|
||||
|
||||
|
19
request/https.go
Normal file
19
request/https.go
Normal file
@ -0,0 +1,19 @@
|
||||
package request
|
||||
|
||||
type HttpsRequest struct {
|
||||
Raw *[]byte
|
||||
}
|
||||
|
||||
func NewHttpsRequest(raw *[]byte) HttpsRequest {
|
||||
return HttpsRequest{
|
||||
Raw: raw,
|
||||
}
|
||||
}
|
||||
|
||||
func (r HttpsRequest) SplitInChunks() [][]byte {
|
||||
if len(*r.Raw) < 1 {
|
||||
return [][]byte{*r.Raw}
|
||||
}
|
||||
|
||||
return [][]byte{(*r.Raw)[:1], (*r.Raw)[1:]}
|
||||
}
|
Loading…
Reference in New Issue
Block a user