v0.5: (BREAKING) simplified config format, improved output formatting, fixed docker watcher

This commit is contained in:
yusing
2024-09-16 03:48:39 +08:00
parent 719693deb7
commit 5be8659a99
34 changed files with 165 additions and 343 deletions

View File

@@ -1,9 +1,9 @@
package proxy
import (
"fmt"
"net/http"
"net/url"
"strconv"
E "github.com/yusing/go-proxy/error"
M "github.com/yusing/go-proxy/models"
@@ -39,7 +39,7 @@ func NewEntry(m *M.ProxyEntry) (any, E.NestedError) {
if scheme.IsStream() {
return validateStreamEntry(m)
}
return validateEntry(m, *scheme)
return validateEntry(m, scheme)
}
func validateEntry(m *M.ProxyEntry, s T.Scheme) (*Entry, E.NestedError) {
@@ -55,7 +55,7 @@ func validateEntry(m *M.ProxyEntry, s T.Scheme) (*Entry, E.NestedError) {
if err.IsNotNil() {
return nil, err
}
url, err := E.Check(url.Parse(s.String() + "://" + host.String() + ":" + strconv.Itoa(int(port))))
url, err := E.Check(url.Parse(fmt.Sprintf("%s://%s:%d", s, host, port)))
if err.IsNotNil() {
return nil, err
}