1
0
mirror of https://github.com/labstack/echo.git synced 2025-01-10 00:28:23 +02:00
echo/engine/engine.go

79 lines
1.2 KiB
Go
Raw Normal View History

package engine
import (
"io"
"time"
"github.com/labstack/gommon/log"
)
type (
Engine interface {
SetHandler(Handler)
SetLogger(*log.Logger)
Start()
}
Request interface {
TLS() bool
Scheme() string
Host() string
URI() string
URL() URL
Header() Header
// Proto() string
// ProtoMajor() int
// ProtoMinor() int
RemoteAddress() string
Method() string
Body() io.ReadCloser
FormValue(string) string
Object() interface{}
}
Response interface {
Header() Header
WriteHeader(int)
Write(b []byte) (int, error)
Status() int
Size() int64
Committed() bool
SetWriter(io.Writer)
Writer() io.Writer
Object() interface{}
}
Header interface {
Add(string, string)
Del(string)
Get(string) string
Set(string, string)
Object() interface{}
}
URL interface {
SetPath(string)
Path() string
QueryValue(string) string
Object() interface{}
}
Config struct {
Address string
TLSCertfile string
TLSKeyfile string
ReadTimeout time.Duration
WriteTimeout time.Duration
}
Handler interface {
ServeHTTP(Request, Response)
}
HandlerFunc func(Request, Response)
)
func (h HandlerFunc) ServeHTTP(req Request, res Response) {
h.ServeHTTP(req, res)
}