MCPcopy
hub / github.com/ChineseSubFinder/ChineseSubFinder / ReadCustomAuthFile

Function ReadCustomAuthFile

pkg/custom_file.go:34–58  ·  view source on GitHub ↗
(log *logrus.Logger)

Source from the content-addressed store, hash-verified

32}
33
34func ReadCustomAuthFile(log *logrus.Logger) bool {
35 if IsFile(customAuth) == false {
36 return false
37 } else {
38 bytes, err := os.ReadFile(customAuth)
39 if err != nil {
40 log.Errorln("ReadFile CustomAuth Error", err)
41 return false
42 }
43
44 nowContent := string(bytes)
45 authStings := strings.Split(nowContent, "@@@@")
46 if len(authStings) != 3 {
47 log.Errorln("ReadFile CustomAuth Error", err)
48 return false
49 }
50
51 SetBaseKey(authStings[0])
52 SetAESKey16(authStings[1])
53 SetAESIv16(authStings[2])
54
55 log.Infoln("Use CustomAuth")
56 return true
57 }
58}
59
60const (
61 defPort = 19035

Callers 10

TestNewSupplierFunction · 0.92
defInstanceFunction · 0.92
defInstanceFunction · 0.92
defInstanceFunction · 0.92
defInstanceFunction · 0.92
defInstanceFunction · 0.92
defInstanceFunction · 0.92
ProcessFunction · 0.92
initFunction · 0.92

Calls 4

SetBaseKeyFunction · 0.85
SetAESKey16Function · 0.85
SetAESIv16Function · 0.85
IsFileFunction · 0.70

Tested by 8

TestNewSupplierFunction · 0.74
defInstanceFunction · 0.74
defInstanceFunction · 0.74
defInstanceFunction · 0.74
defInstanceFunction · 0.74
defInstanceFunction · 0.74
defInstanceFunction · 0.74