Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Dec 15, 2024
1 parent e827d76 commit c3ed913
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 125 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
## v1.7.9~

*??? ??, ????*
### CHANGES

- `pkg/anonymity/logger`: add WithConn(string)

<!-- ... -->

Expand Down
10 changes: 10 additions & 0 deletions pkg/anonymity/logger/log_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type sLogger struct {
fHash []byte
fProof uint64
fSize uint64
fConn string
fPubKey asymmetric.IPubKey
}

Expand Down Expand Up @@ -51,6 +52,10 @@ func (p *sLogger) GetProof() uint64 {
return p.fProof
}

func (p *sLogger) GetConn() string {
return p.fConn
}

func (p *sLogger) Build() ILogGetter {
return p
}
Expand Down Expand Up @@ -79,3 +84,8 @@ func (p *sLogger) WithSize(pSize int) ILogBuilder {
p.fSize = uint64(pSize)
return p
}

func (p *sLogger) WithConn(pConn string) ILogBuilder {
p.fConn = pConn
return p
}
9 changes: 8 additions & 1 deletion pkg/anonymity/logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const (
tcHash = "hash-example"
tcProof = 3
tcSize = 8192
tcConn = "connection"
)

func TestLogger(t *testing.T) {
Expand All @@ -23,7 +24,8 @@ func TestLogger(t *testing.T) {
WithProof(tcProof).
WithPubKey(pubKey).
WithSize(tcSize).
WithType(CLogInfoExist)
WithType(CLogInfoExist).
WithConn(tcConn)

getter := builder.Build()
if getter.GetService() != tcService {
Expand Down Expand Up @@ -55,4 +57,9 @@ func TestLogger(t *testing.T) {
t.Error("getter.GetType() != CLogInfoExist")
return
}

if getter.GetConn() != tcConn {
t.Error("getter.GetConn() != tcConn")
return
}
}
2 changes: 2 additions & 0 deletions pkg/anonymity/logger/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type ILogBuilder interface {
WithSize(int) ILogBuilder
WithProof(uint64) ILogBuilder
WithHash([]byte) ILogBuilder
WithConn(string) ILogBuilder
WithPubKey(asymmetric.IPubKey) ILogBuilder
}

Expand All @@ -54,5 +55,6 @@ type ILogGetter interface {
GetSize() uint64
GetProof() uint64
GetHash() []byte
GetConn() string
GetPubKey() asymmetric.IPubKey
}
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 c3ed913

Please sign in to comment.