Fix priority bug

master
Regela 3 months ago
parent 2494a21d4f
commit a05f82a9eb
  1. 5
      go.mod
  2. 6
      src/main.go

@ -0,0 +1,5 @@
module RegelaHttpsBalancer
go 1.22.5
require github.com/goccy/go-yaml v1.14.3

@ -4,7 +4,6 @@ import (
"flag" "flag"
"fmt" "fmt"
"github.com/goccy/go-yaml" "github.com/goccy/go-yaml"
"io/ioutil"
"log" "log"
"net" "net"
"os" "os"
@ -69,7 +68,9 @@ func printExample() {
out, _ := yaml.Marshal(settings) out, _ := yaml.Marshal(settings)
fmt.Printf("%s", out) fmt.Printf("%s", out)
} }
var settings Settings var settings Settings
func main() { func main() {
printExampleFlag := flag.Bool("example", false, "") printExampleFlag := flag.Bool("example", false, "")
ConfigFile := flag.String("i", "none", "/path/to/config/file.yml") ConfigFile := flag.String("i", "none", "/path/to/config/file.yml")
@ -80,7 +81,7 @@ func main(){
os.Exit(0) os.Exit(0)
} }
cf, err := ioutil.ReadFile(*ConfigFile) cf, err := os.ReadFile(*ConfigFile)
if err != nil { if err != nil {
log.Fatalf("Read configuration error: %s", err.Error()) log.Fatalf("Read configuration error: %s", err.Error())
} }
@ -126,6 +127,7 @@ func handleConnection(conn net.Conn, listener Listener) {
finded = true finded = true
conn2, err = net.Dial(listener.Protocol, rule.Ip) conn2, err = net.Dial(listener.Protocol, rule.Ip)
fmt.Println(rule.Host) fmt.Println(rule.Host)
break
} }
} }
if !finded { if !finded {

Loading…
Cancel
Save