[fix] Changed module name

This commit is contained in:
Piotr Biernat 2021-11-15 16:33:31 +01:00
parent 8a4429cb3f
commit 92fb8356f1
6 changed files with 18 additions and 21 deletions

2
go.mod
View File

@ -1,4 +1,4 @@
module vegvisir module git.pbiernat.dev/golang/vegvisir
go 1.17 go 1.17

2
pkg/cache/cache.go vendored
View File

@ -10,8 +10,8 @@
package cache package cache
import ( import (
"git.pbiernat.dev/golang/vegvisir/pkg/config"
"log" "log"
"vegvisir/pkg/config"
) )
const ( const (

View File

@ -10,12 +10,11 @@
package cache package cache
import ( import (
"github.com/go-redis/redis"
"log" "log"
"os" "os"
"strconv" "strconv"
"time" "time"
"github.com/go-redis/redis"
) )
// NewRedisDatastore function // NewRedisDatastore function

View File

@ -11,14 +11,14 @@ package main
import ( import (
"flag" "flag"
"git.pbiernat.dev/golang/vegvisir/pkg/server"
"log" "log"
"net/http" "net/http"
_ "net/http/pprof"
"os" "os"
"runtime" "runtime"
"runtime/pprof" "runtime/pprof"
"vegvisir/pkg/server"
) )
import _ "net/http/pprof"
var ( var (
cPath = flag.String("c", "vegvisir.json", "Path to config file") cPath = flag.String("c", "vegvisir.json", "Path to config file")

View File

@ -1,4 +1,3 @@
// ___ ____ ___ ___ // ___ ____ ___ ___
// \ \ / / | _ | __| \ \ / / || | __ || || _ | // \ \ / / | _ | __| \ \ / / || | __ || || _ |
// \ \/ / |___ | |__ \ \/ / || |___ || ||___| // \ \/ / |___ | |__ \ \/ / || |___ || ||___|
@ -12,18 +11,18 @@ package server
import ( import (
"fmt" "fmt"
"git.pbiernat.dev/golang/vegvisir/pkg/cache"
"git.pbiernat.dev/golang/vegvisir/pkg/config"
"log" "log"
"regexp" "regexp"
"strings" "strings"
"vegvisir/pkg/cache"
"vegvisir/pkg/config"
) )
// Router struct // Router struct
type Router struct { type Router struct {
config *config.Config config *config.Config
//cache map[string]cache.RouteCache //cache map[string]cache.RouteCache
cache *cache.MemoryDatastore cache *cache.MemoryDatastore
//cache *cache.RedisDatastore //cache *cache.RedisDatastore
} }
@ -65,7 +64,7 @@ func (r *Router) FindByRequestURL(url []byte) (bool, *cache.RouteCache) {
//routeJSON, _ := ffjson.Marshal(&route) // FIXME: TMP //routeJSON, _ := ffjson.Marshal(&route) // FIXME: TMP
if err := r.cache.SetKey("route_" + sURL, route, r.config.Cache.RouteTTL); err != nil { if err := r.cache.SetKey("route_"+sURL, route, r.config.Cache.RouteTTL); err != nil {
// FIXME: ^^ use cache.Manager* after refactor // FIXME: ^^ use cache.Manager* after refactor
log.Println("Error saving route cache:", sURL) log.Println("Error saving route cache:", sURL)
} }

View File

@ -12,15 +12,14 @@ package server
import ( import (
"context" "context"
"fmt" "fmt"
"git.pbiernat.dev/golang/vegvisir/pkg/cache"
"git.pbiernat.dev/golang/vegvisir/pkg/config"
"github.com/valyala/fasthttp"
"log" "log"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
"time" "time"
"vegvisir/pkg/cache"
"vegvisir/pkg/config"
"github.com/valyala/fasthttp"
) )
const ( const (
@ -65,12 +64,12 @@ func (s *Server) Run() {
go func() { go func() {
serverAddress := s.config.Server.Address + ":" + fmt.Sprint(s.config.Server.Port) serverAddress := s.config.Server.Address + ":" + fmt.Sprint(s.config.Server.Port)
s.daemon = &fasthttp.Server{ s.daemon = &fasthttp.Server{
Handler: s.mainHandler, Handler: s.mainHandler,
ReadTimeout: 15 * time.Second, ReadTimeout: 15 * time.Second,
WriteTimeout: 20 * time.Second, WriteTimeout: 20 * time.Second,
MaxConnsPerIP: 500, MaxConnsPerIP: 500,
MaxRequestsPerConn: 500, MaxRequestsPerConn: 500,
IdleTimeout: 15 * time.Second, // aka KeepAlive IdleTimeout: 15 * time.Second, // aka KeepAlive
//CloseOnShutdown: true, //CloseOnShutdown: true,
} }