Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Oct 31, 2024
1 parent 90704b8 commit 285630a
Show file tree
Hide file tree
Showing 5 changed files with 322 additions and 343 deletions.
10 changes: 6 additions & 4 deletions hidden-lake.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

const (
CVersion = "v1.7.4~"
CDefaultNetwork = "_default_network_"
CDefaultNetwork = "__default_network__"
)

var (
Expand All @@ -23,13 +23,15 @@ func init() {
if err := encoding.DeserializeYAML(gNetworks, networksYAML); err != nil {
panic(err)
}
GNetworks = networksYAML.FNetworks
if _, ok := GNetworks[CDefaultNetwork]; !ok {
panic(fmt.Sprintf("'%s' = nil", CDefaultNetwork))
if _, ok := networksYAML.FNetworks[CDefaultNetwork]; ok {
panic(fmt.Sprintf("network '%s' already exist", CDefaultNetwork))
}
GNetworks = networksYAML.FNetworks
GNetworks[CDefaultNetwork] = networksYAML.FSettings
}

type SNetworksYAML struct {
FSettings SNetwork `yaml:"settings"`
FNetworks map[string]SNetwork `yaml:"networks"`
}

Expand Down
15 changes: 0 additions & 15 deletions hidden-lake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,4 @@ func TestHiddenLakeNetworks(t *testing.T) {
t.Error("network.FQueuePeriodMS != 5_000")
return
}

if len(network.FConnections) == 0 {
t.Error("len(network.FConnections) == 0")
return
}

connection := network.FConnections[0]
if connection.FHost != "127.0.0.1" {
t.Error(`connection.FHost != "127.0.0.1"`)
return
}
if connection.FPort != 9581 {
t.Error(`connection.FPort != 9581`)
return
}
}
10 changes: 1 addition & 9 deletions networks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,4 @@ networks:
connections:
# provider=4vps.su, location=Russia/Novosibirsk, logging=true
- host: 193.233.18.245
port: 9581

# network for getting default settings
_default_network_:
<<: *default_settings
connections:
# connection for testing
- host: 127.0.0.1
port: 9581
port: 9581
2 changes: 1 addition & 1 deletion test/result/badge_codelines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 285630a

Please sign in to comment.