Merge branch 'master' into old-engine

This commit is contained in:
nikk gitanes
2023-08-23 18:15:48 +03:00
22 changed files with 257 additions and 61 deletions

View File

@@ -3,8 +3,8 @@ package auth
import (
"encoding/base64"
"encoding/json"
"io/ioutil"
"net/http"
"os"
"path/filepath"
"reflect"
"strings"
@@ -28,7 +28,7 @@ func SetupAuth(engine *gin.Engine) *gin.RouterGroup {
}
func getAccounts() gin.Accounts {
buf, err := ioutil.ReadFile(filepath.Join(settings.Path, "accs.db"))
buf, err := os.ReadFile(filepath.Join(settings.Path, "accs.db"))
if err != nil {
return nil
}

View File

@@ -4,9 +4,9 @@ import (
"bufio"
"bytes"
"errors"
"io/ioutil"
"net"
"net/http"
"os"
"path/filepath"
"strings"
@@ -22,11 +22,11 @@ func Blocker() gin.HandlerFunc {
}
name := filepath.Join(settings.Path, "bip.txt")
buf, _ := ioutil.ReadFile(name)
buf, _ := os.ReadFile(name)
blackIpList := scanBuf(buf)
name = filepath.Join(settings.Path, "wip.txt")
buf, _ = ioutil.ReadFile(name)
buf, _ = os.ReadFile(name)
whiteIpList := scanBuf(buf)
if blackIpList.NumRanges() == 0 && whiteIpList.NumRanges() == 0 {

View File

@@ -2,6 +2,7 @@ package web
import (
"net"
"os"
"sort"
"server/rutor"
@@ -36,8 +37,8 @@ func Start(port string) {
}
err := BTS.Connect()
if err != nil {
waitChan <- err
return
log.TLogln("BTS.Connect() error!", err) // waitChan <- err
os.Exit(1) // return
}
rutor.Start()