MCPcopy Create free account
hub / github.com/Hidden-Node/GooseRelayVPN-AndroidClient / addRedactedConfig

Function addRedactedConfig

cmd/client/diagnostics.go:205–222  ·  view source on GitHub ↗
(zw *zip.Writer, configPath string)

Source from the content-addressed store, hash-verified

203}
204
205func addRedactedConfig(zw *zip.Writer, configPath string) error {
206 w, err := zw.Create("client_config.redacted.json")
207 if err != nil {
208 return err
209 }
210 raw, err := os.ReadFile(configPath)
211 if err != nil {
212 _, writeErr := fmt.Fprintf(w, "unable to read config %q: %v\n", configPath, err)
213 return writeErr
214 }
215 redacted, err := redactConfigJSON(raw)
216 if err != nil {
217 _, writeErr := fmt.Fprintf(w, "unable to parse config as JSON; raw config omitted: %v\n", err)
218 return writeErr
219 }
220 _, err = w.Write(redacted)
221 return err
222}
223
224func redactConfigJSON(raw []byte) ([]byte, error) {
225 dec := json.NewDecoder(bytes.NewReader(raw))

Callers 1

writeDiagnosticsZipFunction · 0.85

Calls 2

redactConfigJSONFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected