Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor bootstrap controller to move filter behavior to entity #46

Merged

Conversation

elct9620
Copy link
Contributor

Refactor to follow Clean Architecture:

Note

Controller (in stunmesh is UseCase) should not know the *config.Config

The current design will use config.Config.Interfaces is not a good design. Therefore we should stop using more.

To improve it, the Allowed Peers will filter by *entity.PeerFilterService to provide a high-level business logic.

allowPeers, err := ctrl.filterService.Execute(ctx, deviceEntity.Name(), device.PublicKey[:])

It will return all peers using object implements entity.PeerSearcher to look up any peers by device name. Then filter it by entity.PeerAllower which answers a entity.PeerId is found in config or not.

@elct9620 elct9620 force-pushed the feat/refactor-bootstrap-controller branch from 10a82d0 to 8b709be Compare September 30, 2024 14:14
@elct9620 elct9620 force-pushed the feat/refactor-bootstrap-controller branch from 8b709be to 0b9d3e2 Compare September 30, 2024 14:15
@tjjh89017 tjjh89017 merged commit db3d2bc into tjjh89017:main Sep 30, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants