Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Jan 28, 2025
1 parent fb808e6 commit f0b8984
Show file tree
Hide file tree
Showing 10 changed files with 345 additions and 380 deletions.
Binary file modified docs/hidden_lake_anonymous_network.docx
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/hidden_lake_anonymous_network_scheme.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func pushMessage(
hln_client.NewBuilder(),
hln_client.NewRequester(pClient),
)
if err := hlnClient.Redirect(pCtx, pFriends, "", msg); err != nil {
if err := hlnClient.Redirect(pCtx, pFriends, msg); err != nil {
return nil, errors.Join(ErrPushMessage, err)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func HandleIncomingRedirectHTTP(
}

friends, err := pHLSClient.GetFriends(pCtx)
if err != nil || len(friends) < 2 {
if err != nil || len(friends) == 0 {
pLogger.PushWarn(logBuilder.WithMessage("get_friends"))
_ = api.Response(pW, http.StatusNotAcceptable, "failed: get friends")
return
Expand All @@ -86,7 +86,7 @@ func HandleIncomingRedirectHTTP(
hln_client.NewBuilder(),
hln_client.NewRequester(pHLSClient),
)
if err := hlnClient.Redirect(pCtx, alias.GetAliasesList(friends), aliasName, rawMsg); err != nil {
if err := hlnClient.Redirect(pCtx, alias.GetAliasesList(friends), rawMsg); err != nil {
pLogger.PushWarn(logBuilder.WithMessage("redirect"))
_ = api.Response(pW, http.StatusBadGateway, "failed: redirect")
return
Expand Down
17 changes: 1 addition & 16 deletions internal/applications/notifier/pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,18 @@ func (p *sClient) Finalyze(
func (p *sClient) Redirect(
pCtx context.Context,
pTargets []string,
pIgnore string,
pMsg layer1.IMessage,
) error {
if r := random.NewRandom(); r.GetBool() {
return p.Finalyze(pCtx, pTargets, pMsg)
}
randTarget := make([]string, 0, 1)
if x := getRandomTarget(deleteTarget(pTargets, pIgnore)); x != "" {
if x := getRandomTarget(pTargets); x != "" {
randTarget = append(randTarget, x)
}
return p.fRequester.Broadcast(pCtx, randTarget, p.fBuilder.Redirect(pMsg))
}

func deleteTarget(pFriends []string, pIgnore string) []string {
if pIgnore == "" {
return pFriends
}
result := make([]string, 0, len(pFriends))
for _, alias := range pFriends {
if alias == pIgnore {
continue
}
result = append(result, alias)
}
return result
}

func getRandomTarget(pFriends []string) string {
if len(pFriends) == 0 {
return ""
Expand Down
36 changes: 0 additions & 36 deletions internal/applications/notifier/pkg/client/settings.go

This file was deleted.

7 changes: 1 addition & 6 deletions internal/applications/notifier/pkg/client/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

type IClient interface {
Finalyze(context.Context, []string, layer1.IMessage) error
Redirect(context.Context, []string, string, layer1.IMessage) error
Redirect(context.Context, []string, layer1.IMessage) error
}

type IRequester interface {
Expand All @@ -20,8 +20,3 @@ type IBuilder interface {
Finalyze(layer1.IMessage) hls_request.IRequest
Redirect(layer1.IMessage) hls_request.IRequest
}

type ISettings interface {
GetWorkSizeBits() uint64
GetPowParallel() uint64
}
16 changes: 14 additions & 2 deletions internal/webui/template/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ <h1 class="col-md-10 mb-3 mx-auto h3 text-white">{{.FAppFullName}}</h1>
</li>
<li>
<p class="text-left">
<a href="https://github.com/number571/hidden-lake/tree/master/cmd/hla/hla_tcp"
class="text-info" target="_blank">Hidden Lake Adapter (TCP)</a>;
<a href="https://github.com/number571/hidden-lake/tree/master/cmd/hla"
class="text-info" target="_blank">Hidden Lake Adapters</a>;
</p>
</li>
<li>
Expand All @@ -248,6 +248,18 @@ <h1 class="col-md-10 mb-3 mx-auto h3 text-white">{{.FAppFullName}}</h1>
class="text-info" target="_blank">Hidden Lake Remoter</a>;
</p>
</li>
<li>
<p class="text-left">
<a href="https://github.com/number571/hidden-lake/tree/master/cmd/hlp"
class="text-info" target="_blank">Hidden Lake Pinger</a>;
</p>
</li>
<li>
<p class="text-left">
<a href="https://github.com/number571/hidden-lake/tree/master/cmd/hln"
class="text-info" target="_blank">Hidden Lake Notifier</a>;
</p>
</li>
</ol>
</div>
</div>
Expand Down
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 f0b8984

Please sign in to comment.