35 lines
863 B
Go
35 lines
863 B
Go
package web
|
|
|
|
import (
|
|
"code.mrmelon54.com/melon/summer/pkg/utils"
|
|
"net/http"
|
|
)
|
|
|
|
type ApiRoute struct {
|
|
Id uint64 `json:"id" xorm:"pk autoincr"`
|
|
DomainId uint64 `json:"domain_id"`
|
|
Version uint64 `json:"version"`
|
|
Route string `json:"route"`
|
|
Dst string `json:"dst"`
|
|
SecureMode *bool `json:"secure_mode,omitempty"`
|
|
IgnoreCert *bool `json:"ignore_cert,omitempty"`
|
|
Enabled *bool `json:"enabled"`
|
|
}
|
|
|
|
func (a ApiRoute) GetId() uint64 { return a.Id }
|
|
|
|
func (a ApiRoute) SetEnabled(v bool) ApiRoute {
|
|
a.Enabled = utils.PBool(v)
|
|
return a
|
|
}
|
|
|
|
func (a ApiRoute) ClearForNew() ApiRoute {
|
|
a.Id = 0
|
|
return a
|
|
}
|
|
|
|
func (a ApiRoute) IsSecureMode() bool { return utils.SBool(a.SecureMode) }
|
|
func (a ApiRoute) IsIgnoreCert() bool { return utils.SBool(a.IgnoreCert) }
|
|
|
|
func (a ApiRoute) UpdateHeaders(_ http.Header) {} // purposefully a stub
|