Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Oct 14, 2023
1 parent 7f8f3ad commit 565b838
Show file tree
Hide file tree
Showing 22 changed files with 21 additions and 76 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Update `cmd/hidden_lake/messenger`: delete auth
- Update `cmd/hidden_lake/service`: delete SetPrivKey/ResetPrivKey
- Update `cmd/hidden_lake/service`: generates priv key file
- Update `cmd/hidden_lake/*`: workSize, storageKey are can be null value

### BUG FIXES

Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,16 +358,14 @@ Default config `hlm.cfg`
```json
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"language": "ENG",
"storage_key": "_",
"address": {
"interface": "127.0.0.1:9591",
"incoming": "127.0.0.1:9592"
Expand Down
4 changes: 1 addition & 3 deletions cmd/hidden_lake/_default_cfg/docker/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"language": "ENG",
"storage_key": "_",
"address": {
"interface": ":9591",
"incoming": ":9592"
Expand Down
4 changes: 1 addition & 3 deletions cmd/hidden_lake/_default_cfg/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"language": "ENG",
"storage_key": "_",
"address": {
"interface": "127.0.0.1:9591",
"incoming": "127.0.0.1:9592"
Expand Down
4 changes: 1 addition & 3 deletions cmd/hidden_lake/messenger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@ Default config `hlm.cfg`
```json
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"language": "ENG",
"storage_key": "_",
"address": {
"interface": "127.0.0.1:9591",
"incoming": "127.0.0.1:9592"
Expand Down
3 changes: 1 addition & 2 deletions cmd/hidden_lake/messenger/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func (p *SConfigSettings) GetWorkSizeBits() uint64 {

func (p *SConfig) isValid() bool {
return true &&
p.FSettings.FMessagesCapacity != 0 &&
p.FSettings.FWorkSizeBits != 0
p.FSettings.FMessagesCapacity != 0
}

func (p *SConfig) initConfig() error {
Expand Down
6 changes: 2 additions & 4 deletions cmd/hidden_lake/messenger/internal/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ func InitConfig(cfgPath string, initCfg *SConfig) (IConfig, error) {
initCfg = &SConfig{
FSettings: &SConfigSettings{
FMessagesCapacity: hlm_settings.CDefaultCapMessages,
FWorkSizeBits: hlm_settings.CDefaultWorkSizeBits,
},
FLogging: []string{logger.CLogInfo, logger.CLogWarn, logger.CLogErro},
FStorageKey: hlm_settings.CDefaultStorageKey,
FLanguage: hlm_settings.CDefaultLanguage,
FLogging: []string{logger.CLogInfo, logger.CLogWarn, logger.CLogErro},
FLanguage: hlm_settings.CDefaultLanguage,
FAddress: &SAddress{
FInterface: hlm_settings.CDefaultInterfaceAddress,
FIncoming: hlm_settings.CDefaultIncomingAddress,
Expand Down
8 changes: 3 additions & 5 deletions cmd/hidden_lake/messenger/pkg/settings/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const (
)

const (
CIamAliasName = "__iam__"
CDefaultLanguage = "ENG"
CDefaultStorageKey = "_"
CIamAliasName = "__iam__"
CDefaultLanguage = "ENG"
)

const (
Expand All @@ -27,8 +26,7 @@ const (
)

const (
CDefaultWorkSizeBits = 20 // bits
CDefaultCapMessages = (2 << 10) // count
CDefaultCapMessages = (2 << 10) // count
)

const (
Expand Down
1 change: 0 additions & 1 deletion cmd/hidden_lake/service/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ func (p *SConfig) GetSettings() IConfigSettings {
func (p *SConfig) isValid() bool {
return true &&
p.FSettings.FMessageSizeBytes != 0 &&
p.FSettings.FWorkSizeBits != 0 &&
p.FSettings.FKeySizeBits != 0 &&
p.FSettings.FQueuePeriodMS != 0
}
Expand Down
1 change: 0 additions & 1 deletion cmd/hidden_lake/traffic/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func (p *SConfigSettings) GetLimitVoidSizeBytes() uint64 {
func (p *SConfig) isValid() bool {
return true &&
p.FSettings.FMessageSizeBytes != 0 &&
p.FSettings.FWorkSizeBits != 0 &&
(p.FSettings.FMessagesCapacity != 0 || p.FSettings.FQueuePeriodMS != 0)
}

Expand Down
3 changes: 0 additions & 3 deletions cmd/hidden_lake/traffic/internal/database/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ func (p *sSettings) mustNotNull() ISettings {
if p.FPath == "" {
panic(`p.FPath == ""`)
}
if p.FWorkSizeBits == 0 {
panic(`p.FWorkSizeBits == 0`)
}
if p.FMessageSizeBytes == 0 {
panic(`p.FMessageSizeBytes == 0`)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"language": "ENG",
"storage_key": "_",
"address": {
"interface": "messenger-node1:8080",
"incoming": "messenger-node1:8081"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"language": "ENG",
"storage_key": "_",
"address": {
"interface": "messenger-node2:7070",
"incoming": "messenger-node2:7071"
Expand Down
4 changes: 1 addition & 3 deletions examples/anon_messenger/default/node1_hlm/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"storage_key": "_",
"address": {
"interface": "localhost:8080",
"incoming": "localhost:8081"
Expand Down
4 changes: 1 addition & 3 deletions examples/anon_messenger/default/node2_hlm/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"storage_key": "_",
"address": {
"interface": "localhost:7070",
"incoming": "localhost:7071"
Expand Down
4 changes: 1 addition & 3 deletions examples/anon_messenger/prod_test/node1_hlm/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"storage_key": "_",
"address": {
"interface": "localhost:8080",
"incoming": "localhost:8081"
Expand Down
4 changes: 1 addition & 3 deletions examples/anon_messenger/prod_test/node2_hlm/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"logging": [
"info",
"warn",
"erro"
],
"storage_key": "_",
"address": {
"interface": "localhost:7070",
"incoming": "localhost:7071"
Expand Down
4 changes: 1 addition & 3 deletions examples/anon_messenger/secret_channel/node1_hlm/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"address": {
"interface": "localhost:8080",
"incoming": "localhost:8081"
},
"storage_key": "_",
"connection": "localhost:8572",
"backup_connections": [
"127.0.0.1:8573"
Expand Down
4 changes: 1 addition & 3 deletions examples/anon_messenger/secret_channel/node2_hlm/hlm.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"settings": {
"messages_capacity": 2048,
"work_size_bits": 20
"messages_capacity": 2048
},
"storage_key": "_",
"address": {
"interface": "localhost:7070",
"incoming": "localhost:7071"
Expand Down
3 changes: 0 additions & 3 deletions pkg/client/message/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ func NewSettings(pSett *SSettings) ISettings {
}

func (p *sSettings) mustNotNull() ISettings {
if p.FWorkSizeBits == 0 {
panic(`p.FWorkSizeBits == 0`)
}
if p.FMessageSizeBytes == 0 {
panic(`p.FMessageSizeBytes == 0`)
}
Expand Down
6 changes: 0 additions & 6 deletions pkg/storage/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ func (p *sSettings) mustNotNull() ISettings {
if p.FPath == "" {
panic(`p.FPath == ""`)
}
if p.FWorkSize == 0 {
panic(`p.FWorkSize == 0`)
}
if p.FPassword == "" {
panic(`p.FPassword == ""`)
}
return p
}

Expand Down
17 changes: 2 additions & 15 deletions pkg/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestCryptoStorage(t *testing.T) {
}

func TestSettings(t *testing.T) {
for i := 0; i < 3; i++ {
for i := 0; i < 1; i++ {
testSettings(t, i)
}
}
Expand All @@ -37,20 +37,7 @@ func testSettings(t *testing.T, n int) {
}()
switch n {
case 0:
_ = NewSettings(&SSettings{
FWorkSize: testutils.TCWorkSize,
FPassword: "CIPHER",
})
case 1:
_ = NewSettings(&SSettings{
FPath: "path",
FPassword: "CIPHER",
})
case 2:
_ = NewSettings(&SSettings{
FPath: "path",
FWorkSize: testutils.TCWorkSize,
})
_ = NewSettings(&SSettings{})
}
}

Expand Down

0 comments on commit 565b838

Please sign in to comment.