🗑️ Clean up project

This commit is contained in:
2024-09-29 23:51:05 +08:00
parent 232ded4cd4
commit 28d3a3fa06
32 changed files with 95 additions and 395 deletions

View File

@ -38,7 +38,7 @@ func makeHypertextResponse(c *fiber.Ctx, dest *Destination) error {
}
limit := time.Duration(num) * time.Millisecond
uri := dest.MakeUri(c)
uri := dest.BuildUri(c)
return proxy.Do(c, uri, &fasthttp.Client{
ReadTimeout: limit,
WriteTimeout: limit,

View File

@ -60,13 +60,13 @@ func (v *Destination) GetType() DestinationType {
func (v *Destination) GetRawUri() (string, url.Values) {
uri := strings.SplitN(v.Uri, "://", 2)[1]
data := strings.SplitN(uri, "?", 2)
data = append(data, " ") // Make data array least have two element
data = append(data, " ") // Make the data array least have two elements
qs, _ := url.ParseQuery(data[1])
return data[0], qs
}
func (v *Destination) MakeUri(ctx *fiber.Ctx) string {
func (v *Destination) BuildUri(ctx *fiber.Ctx) string {
var queries []string
for k, v := range ctx.Queries() {
parsed, _ := url.QueryUnescape(v)
@ -85,5 +85,5 @@ func (v *Destination) MakeUri(ctx *fiber.Ctx) string {
}
func (v *Destination) MakeWebsocketUri(ctx *fiber.Ctx) string {
return strings.Replace(v.MakeUri(ctx), "http", "ws", 1)
return strings.Replace(v.BuildUri(ctx), "http", "ws", 1)
}