2016-01-28 23:46:11 -08:00
|
|
|
package engine
|
|
|
|
|
2016-02-04 14:40:08 -08:00
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
"time"
|
2016-02-09 17:16:46 -08:00
|
|
|
|
|
|
|
"github.com/labstack/echo/logger"
|
2016-02-04 14:40:08 -08:00
|
|
|
)
|
2016-01-28 23:46:11 -08:00
|
|
|
|
|
|
|
type (
|
|
|
|
HandlerFunc func(Request, Response)
|
|
|
|
|
|
|
|
Engine interface {
|
2016-02-09 17:16:46 -08:00
|
|
|
SetHandler(HandlerFunc)
|
|
|
|
SetLogger(logger.Logger)
|
2016-01-28 23:46:11 -08:00
|
|
|
Start()
|
|
|
|
}
|
|
|
|
|
|
|
|
Request interface {
|
2016-02-22 21:13:08 -08:00
|
|
|
TLS() bool
|
2016-02-09 08:12:37 -08:00
|
|
|
Host() string
|
2016-02-08 16:48:03 -08:00
|
|
|
URI() string
|
|
|
|
URL() URL
|
2016-01-28 23:46:11 -08:00
|
|
|
Header() Header
|
|
|
|
// Proto() string
|
|
|
|
// ProtoMajor() int
|
|
|
|
// ProtoMinor() int
|
|
|
|
RemoteAddress() string
|
|
|
|
Method() string
|
|
|
|
Body() io.ReadCloser
|
|
|
|
FormValue(string) string
|
2016-02-08 16:48:03 -08:00
|
|
|
Object() interface{}
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Response interface {
|
|
|
|
Header() Header
|
|
|
|
WriteHeader(int)
|
|
|
|
Write(b []byte) (int, error)
|
|
|
|
Status() int
|
|
|
|
Size() int64
|
|
|
|
Committed() bool
|
2016-02-04 14:40:08 -08:00
|
|
|
SetWriter(io.Writer)
|
|
|
|
Writer() io.Writer
|
2016-02-08 16:48:03 -08:00
|
|
|
Object() interface{}
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Header interface {
|
|
|
|
Add(string, string)
|
|
|
|
Del(string)
|
|
|
|
Get(string) string
|
|
|
|
Set(string, string)
|
2016-02-20 14:04:09 -08:00
|
|
|
Object() interface{}
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
URL interface {
|
|
|
|
SetPath(string)
|
|
|
|
Path() string
|
|
|
|
QueryValue(string) string
|
2016-02-20 14:04:09 -08:00
|
|
|
Object() interface{}
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Config struct {
|
2016-02-04 14:40:08 -08:00
|
|
|
Address string
|
|
|
|
ReadTimeout time.Duration
|
|
|
|
WriteTimeout time.Duration
|
|
|
|
TLSCertfile string
|
|
|
|
TLSKeyfile string
|
2016-01-28 23:46:11 -08:00
|
|
|
}
|
|
|
|
)
|