diff options
author | Joe <rbo@gmx.us> | 2024-01-23 20:20:20 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2024-01-23 20:20:20 +0100 |
commit | b17fa17ff75842afa5e1fe7c8c1af6eeeebb6397 (patch) | |
tree | b7851b958058f4f940b4f0473341294ddaf77532 /src/c_parse.go | |
parent | alright (diff) | |
download | hardflip-b17fa17ff75842afa5e1fe7c8c1af6eeeebb6397.tar.gz hardflip-b17fa17ff75842afa5e1fe7c8c1af6eeeebb6397.tar.bz2 hardflip-b17fa17ff75842afa5e1fe7c8c1af6eeeebb6397.tar.xz hardflip-b17fa17ff75842afa5e1fe7c8c1af6eeeebb6397.tar.zst hardflip-b17fa17ff75842afa5e1fe7c8c1af6eeeebb6397.zip |
bench time
Diffstat (limited to '')
-rw-r--r-- | src/c_parse.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/c_parse.go b/src/c_parse.go index 61d4dfc..c26b4f5 100644 --- a/src/c_parse.go +++ b/src/c_parse.go @@ -57,22 +57,21 @@ import ( "gopkg.in/yaml.v3" ) -func c_read_yaml_file(file string) *HostNode { +func c_read_yaml_file(file string, ui *HardUI) (*HostNode, error) { var host HostNode yaml_file, err := os.ReadFile(file) if err != nil { - // TODO: remove all c_dies with c_err_mode - c_die("error reading file " + file, err) + return nil, err } - if err = yaml.Unmarshal(yaml_file, &host); err != nil { - c_die("error reading yaml file " + file, err) + if err := yaml.Unmarshal(yaml_file, &host); err != nil { + return nil, err } if len(host.Name) == 0 { - return nil + return nil, nil } if len(host.Host) == 0 { - return nil + return nil, nil } if host.Protocol == 0 { if host.Port == 0 { @@ -103,10 +102,10 @@ func c_read_yaml_file(file string) *HostNode { host.Height = 1200 } } else if host.Protocol > 1 { - return nil + return nil, nil } if host.Quality > 2 { host.Quality = 2 } - return &host + return &host, nil } |