]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/ctx.go
Merge branch 'develop'
[nncp.git] / src / ctx.go
index 655c3e9bce07052a6469e5dfa82e1fc4a42134be..cf7d728d42ec06564a30a501fa873c035b48d849 100644 (file)
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2022 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2023 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@ package nncp
 import (
        "errors"
        "fmt"
-       "io/ioutil"
+       "io/fs"
        "os"
        "path/filepath"
        "strconv"
@@ -51,6 +51,8 @@ type Ctx struct {
 
        MCDRxIfis []string
        MCDTxIfis map[string]int
+
+       YggdrasilAliases map[string]string
 }
 
 func (ctx *Ctx) FindNode(id string) (*Node, error) {
@@ -78,7 +80,7 @@ func ensureDir(dirs ...string) error {
                }
                return fmt.Errorf("%s: is not a directory", p)
        }
-       if !os.IsNotExist(err) {
+       if !errors.Is(err, fs.ErrNotExist) {
                return err
        }
        return os.MkdirAll(p, os.FileMode(0777))
@@ -117,7 +119,7 @@ func CtxFromCmdline(
                        return nil, err
                }
        } else {
-               cfgRaw, err := ioutil.ReadFile(cfgPath)
+               cfgRaw, err := os.ReadFile(cfgPath)
                if err != nil {
                        return nil, err
                }