Skip to content

Commit af9138f

Browse files
committed
chore: rename package
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
1 parent f8e3eb4 commit af9138f

9 files changed

Lines changed: 28 additions & 28 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package common
1+
package api
22

33
import (
44
"context"

handler/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"sync"
99
"time"
1010

11-
"github.com/roadrunner-server/http/v5/common"
11+
"github.com/roadrunner-server/http/v5/api"
1212

1313
httpV1proto "github.com/roadrunner-server/api/v4/build/http/v1"
1414
"github.com/roadrunner-server/errors"
@@ -36,7 +36,7 @@ type uploads struct {
3636
type Handler struct {
3737
uploads *uploads
3838
log *zap.Logger
39-
pool common.Pool
39+
pool api.Pool
4040
internalCtx context.Context
4141

4242
internalHTTPCode uint64
@@ -56,7 +56,7 @@ type Handler struct {
5656
}
5757

5858
// NewHandler return 'handler' interface implementation
59-
func NewHandler(cfg *config.Config, pool common.Pool, log *zap.Logger) (*Handler, error) {
59+
func NewHandler(cfg *config.Config, pool api.Pool, log *zap.Logger) (*Handler, error) {
6060
return &Handler{
6161
uploads: &uploads{
6262
dir: cfg.Uploads.Dir,

init.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/quic-go/quic-go/http3"
77
"github.com/roadrunner-server/http/v5/acme"
8-
"github.com/roadrunner-server/http/v5/common"
8+
"github.com/roadrunner-server/http/v5/api"
99
"github.com/roadrunner-server/http/v5/config"
1010
bundledMw "github.com/roadrunner-server/http/v5/middleware"
1111
"github.com/roadrunner-server/http/v5/servers/fcgi"
@@ -71,7 +71,7 @@ func (p *Plugin) applyBundledMiddleware() {
7171
}
7272
}
7373

74-
func (p *Plugin) unmarshal(cfg common.Configurer) error {
74+
func (p *Plugin) unmarshal(cfg api.Configurer) error {
7575
// unmarshal general section
7676
err := cfg.UnmarshalKey(PluginName, &p.cfg)
7777
if err != nil {

plugin.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
rrcontext "github.com/roadrunner-server/context"
1212
"github.com/roadrunner-server/endure/v2/dep"
1313
"github.com/roadrunner-server/errors"
14-
"github.com/roadrunner-server/http/v5/common"
14+
"github.com/roadrunner-server/http/v5/api"
1515
"github.com/roadrunner-server/http/v5/config"
1616
"github.com/roadrunner-server/http/v5/handler"
1717
"github.com/roadrunner-server/http/v5/servers"
@@ -49,7 +49,7 @@ type Plugin struct {
4949
prop propagation.TextMapPropagator
5050

5151
// plugins
52-
server common.Server
52+
server api.Server
5353
log *zap.Logger
5454
// stdlog passed to the http/https/fcgi servers to log their internal messages
5555
stdLog *stdlog.Logger
@@ -59,9 +59,9 @@ type Plugin struct {
5959
cfg *config.Config
6060

6161
// middlewares to chain
62-
mdwr map[string]common.Middleware
62+
mdwr map[string]api.Middleware
6363
// Pool which attached to all servers
64-
pool common.Pool
64+
pool api.Pool
6565
// servers RR handler
6666
handler *handler.Handler
6767
// metrics
@@ -72,7 +72,7 @@ type Plugin struct {
7272

7373
// Init must return configure svc and return true if svc hasStatus enabled. Must return error in case of
7474
// misconfiguration. Services must not be used without proper configuration pushed first.
75-
func (p *Plugin) Init(cfg common.Configurer, log common.Logger, srv common.Server) error {
75+
func (p *Plugin) Init(cfg api.Configurer, log api.Logger, srv api.Server) error {
7676
const op = errors.Op("http_plugin_init")
7777
if !cfg.Has(PluginName) {
7878
return errors.E(op, errors.Disabled)
@@ -100,7 +100,7 @@ func (p *Plugin) Init(cfg common.Configurer, log common.Logger, srv common.Serve
100100

101101
// use time and date in UTC format
102102
p.stdLog = stdlog.New(NewStdAdapter(p.log), "http_plugin: ", stdlog.Ldate|stdlog.Ltime|stdlog.LUTC)
103-
p.mdwr = make(map[string]common.Middleware)
103+
p.mdwr = make(map[string]api.Middleware)
104104

105105
if !p.cfg.EnableHTTP() && !p.cfg.EnableTLS() && !p.cfg.EnableFCGI() {
106106
return errors.E(op, errors.Disabled)
@@ -276,11 +276,11 @@ func (p *Plugin) Reset() error {
276276
func (p *Plugin) Collects() []*dep.In {
277277
return []*dep.In{
278278
dep.Fits(func(pp any) {
279-
mdw := pp.(common.Middleware)
279+
mdw := pp.(api.Middleware)
280280
// just to be safe
281281
p.mu.Lock()
282282
p.mdwr[mdw.Name()] = mdw
283283
p.mu.Unlock()
284-
}, (*common.Middleware)(nil)),
284+
}, (*api.Middleware)(nil)),
285285
}
286286
}

servers/fcgi/fcgi.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"net/http/fcgi"
88
"time"
99

10-
"github.com/roadrunner-server/http/v5/common"
10+
"github.com/roadrunner-server/http/v5/api"
1111
"github.com/roadrunner-server/http/v5/servers"
1212
"github.com/roadrunner-server/tcplisten"
1313

@@ -33,7 +33,7 @@ func NewFCGIServer(handler http.Handler, cfg *FCGI, log *zap.Logger, errLog *log
3333
}
3434
}
3535

36-
func (s *Server) Serve(mdwr map[string]common.Middleware, order []string) error {
36+
func (s *Server) Serve(mdwr map[string]api.Middleware, order []string) error {
3737
const op = errors.Op("serve_fcgi")
3838

3939
if len(mdwr) > 0 {
@@ -64,7 +64,7 @@ func (s *Server) Stop() {
6464
}
6565
}
6666

67-
func applyMiddleware(server *http.Server, middleware map[string]common.Middleware, order []string, log *zap.Logger) {
67+
func applyMiddleware(server *http.Server, middleware map[string]api.Middleware, order []string, log *zap.Logger) {
6868
for i := range order {
6969
if mdwr, ok := middleware[order[i]]; ok {
7070
server.Handler = mdwr.Middleware(server.Handler)

servers/http11/http.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/roadrunner-server/tcplisten"
1010

11-
"github.com/roadrunner-server/http/v5/common"
11+
"github.com/roadrunner-server/http/v5/api"
1212
"github.com/roadrunner-server/http/v5/servers"
1313

1414
"github.com/roadrunner-server/errors"
@@ -72,7 +72,7 @@ func NewHTTPServer(handler http.Handler, cfg *config.Config, errLog *log.Logger,
7272
}
7373

7474
// Serve is a blocking function
75-
func (s *Server) Serve(mdwr map[string]common.Middleware, order []string) error {
75+
func (s *Server) Serve(mdwr map[string]api.Middleware, order []string) error {
7676
const op = errors.Op("serveHTTP")
7777

7878
if len(mdwr) > 0 {
@@ -109,7 +109,7 @@ func (s *Server) Stop() {
109109
}
110110
}
111111

112-
func applyMiddleware(server *http.Server, middleware map[string]common.Middleware, order []string, log *zap.Logger) {
112+
func applyMiddleware(server *http.Server, middleware map[string]api.Middleware, order []string, log *zap.Logger) {
113113
for i := range order {
114114
if mdwr, ok := middleware[order[i]]; ok {
115115
server.Handler = mdwr.Middleware(server.Handler)

servers/http3/http3.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/roadrunner-server/http/v5/tlsconf"
1111
"go.uber.org/zap"
1212

13-
"github.com/roadrunner-server/http/v5/common"
13+
"github.com/roadrunner-server/http/v5/api"
1414
"github.com/roadrunner-server/http/v5/servers"
1515
)
1616

@@ -57,7 +57,7 @@ func NewHTTP3server(handler http.Handler, acmeCfg *acme.Config, cfg *Config, log
5757
return http3Srv, nil
5858
}
5959

60-
func (s *Server) Serve(mdwr map[string]common.Middleware, order []string) error {
60+
func (s *Server) Serve(mdwr map[string]api.Middleware, order []string) error {
6161
const op = errors.Op("serve_HTTP3")
6262

6363
if len(mdwr) > 0 {
@@ -84,7 +84,7 @@ func (s *Server) Stop() {
8484
}
8585
}
8686

87-
func applyMiddleware(server *http3.Server, middleware map[string]common.Middleware, order []string, log *zap.Logger) {
87+
func applyMiddleware(server *http3.Server, middleware map[string]api.Middleware, order []string, log *zap.Logger) {
8888
for i := range order {
8989
if mdwr, ok := middleware[order[i]]; ok {
9090
server.Handler = mdwr.Middleware(server.Handler)

servers/https/https.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/roadrunner-server/tcplisten"
1515

1616
"github.com/roadrunner-server/http/v5/acme"
17-
"github.com/roadrunner-server/http/v5/common"
17+
"github.com/roadrunner-server/http/v5/api"
1818
"github.com/roadrunner-server/http/v5/servers"
1919
"github.com/roadrunner-server/http/v5/tlsconf"
2020

@@ -92,7 +92,7 @@ func NewHTTPSServer(handler http.Handler, cfg *SSL, cfgHTTP2 *HTTP2, errLog *log
9292
}, nil
9393
}
9494

95-
func (s *Server) Serve(mdwr map[string]common.Middleware, order []string) error {
95+
func (s *Server) Serve(mdwr map[string]api.Middleware, order []string) error {
9696
const op = errors.Op("serveHTTPS")
9797
if len(mdwr) > 0 {
9898
applyMiddleware(s.https, mdwr, order, s.log)
@@ -195,7 +195,7 @@ func tlsAddr(host string, forcePort bool, sslPort int) string {
195195
return host
196196
}
197197

198-
func applyMiddleware(server *http.Server, middleware map[string]common.Middleware, order []string, log *zap.Logger) {
198+
func applyMiddleware(server *http.Server, middleware map[string]api.Middleware, order []string, log *zap.Logger) {
199199
for i := range order {
200200
if mdwr, ok := middleware[order[i]]; ok {
201201
server.Handler = mdwr.Middleware(server.Handler)

servers/interface.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package servers
22

33
import (
4-
"github.com/roadrunner-server/http/v5/common"
4+
"github.com/roadrunner-server/http/v5/api"
55
)
66

77
// internal interface to start-stop http servers
88
type InternalServer[T any] interface {
9-
Serve(map[string]common.Middleware, []string) error
9+
Serve(map[string]api.Middleware, []string) error
1010
Server() T
1111
Stop()
1212
}

0 commit comments

Comments
 (0)