feat: add middlewares

This commit is contained in:
Rogee
2024-12-06 17:15:28 +08:00
parent 29894cff9c
commit 869625d70a
10 changed files with 169 additions and 125 deletions

View File

@@ -9,7 +9,7 @@ const DefaultPrefix = "Http"
type Config struct {
StaticPath *string
StaticRoute *string
Host *string
BaseURI *string
Port uint
Tls *Tls
Cors *Cors
@@ -34,12 +34,5 @@ type Whitelist struct {
}
func (h *Config) Address() string {
if h.Host == nil {
return h.PortString()
}
return fmt.Sprintf("%s:%d", *h.Host, h.Port)
}
func (h *Config) PortString() string {
return fmt.Sprintf(":%d", h.Port)
}