refactor: Improve Go docs (#74)

* add go docs, package: parser
* add go docs, package: protocols
* add go docs, package: tracer
This commit is contained in:
Mario Candela
2023-10-15 20:54:53 +02:00
committed by GitHub
parent d77aa0c8a0
commit 5e5d0494a9
3 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,4 @@
// Package protocols is responsible for managing the different protocols
package protocols
import (
@ -5,6 +6,7 @@ import (
"github.com/mariocandela/beelzebub/v3/tracer"
)
// ServiceStrategy is the common interface that each protocol honeypot implements
type ServiceStrategy interface {
Init(beelzebubServiceConfiguration parser.BeelzebubServiceConfiguration, tracer tracer.Tracer) error
}
@ -14,10 +16,11 @@ type ProtocolManager struct {
tracer tracer.Tracer
}
func InitProtocolManager(tracerStrategy tracer.Strategy, strategy ServiceStrategy) *ProtocolManager {
// InitProtocolManager is the method that initializes the protocol manager, receving the concrete tracer and the concrete service
func InitProtocolManager(tracerStrategy tracer.Strategy, serviceStrategy ServiceStrategy) *ProtocolManager {
return &ProtocolManager{
tracer: tracer.GetInstance(tracerStrategy),
strategy: strategy,
strategy: serviceStrategy,
}
}
@ -25,6 +28,7 @@ func (pm *ProtocolManager) SetProtocolStrategy(strategy ServiceStrategy) {
pm.strategy = strategy
}
// InitService is the method that initializes the honeypot
func (pm *ProtocolManager) InitService(beelzebubServiceConfiguration parser.BeelzebubServiceConfiguration) error {
return pm.strategy.Init(beelzebubServiceConfiguration, pm.tracer)
}