Öffentliche Dateiansicht: Raw-Dateien, Tree, Releases und Issues sind ohne Login verfügbar.
pservice/serviceStruct.go
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package pservice

import (
	"encoding/json"
	"os"

	"github.com/adrian-lorenz/noxway/waf"
)

type Services struct {
	Services []Service
}

type Service struct {
	Endpoints     []Endpoint
	BasicEndpoint Endpoint
	Active        bool
	Name          string
	UUID          string
	WAF           waf.WAFConfig `json:"waf"`
}

type Endpoint struct {
	Endpoint           string
	VerifySSL          bool
	CertAuth           bool
	Certs              Certs
	Active             bool
	Name               string
	UUID               string
	OverrideTimeout    int
	WebSocket          bool             `json:"webSocket"`
	HeaderRouteMatches []Header
	HeaderExists       []Header
	HeaderAdd          []Header
	Whitelist          []string
	JWTPreCheck        bool
	JWTData            JWTPreCheck
	HeaderReplace      []HeaderReplace
}

type JWTPreCheck struct {
	
	Header string
	Key   string
	OnlySign bool
	Field string
	Match []string
}

type Header struct {
	Header string
	Value  string
}
type Certs struct {
	CertPEM string
	CertKEY  string
}



type HeaderReplace struct {
	Header   string
	Value    string
	NewValue string
}

func LoadConfig(path string) (*Services, error) {
	var config Services
	data, err := os.ReadFile(path)
	if err != nil {
		return nil, err
	}
	err = json.Unmarshal(data, &config)
	if err != nil {
		return nil, err
	}
	return &config, nil
}

func MarshalConfig(config Services) ([]byte, error) {
	return json.MarshalIndent(config, "", "  ")
}

Sprachen
Go 46%
JavaScript 45%
Markdown 3.3%
HTML 2.5%
YAML 1.7%
JSON 1.1%
Klonen
HTTPS