vpoint.go 445 B

123456789101112131415161718192021222324252627
  1. package core
  2. import (
  3. "fmt"
  4. )
  5. type VPoint struct {
  6. config VConfig
  7. connHandler ConnectionHandler
  8. }
  9. func NewVPoint(config *VConfig) (*VPoint, error) {
  10. var vpoint *VPoint
  11. return vpoint, nil
  12. }
  13. type ConnectionHandler interface {
  14. Listen(port uint16) error
  15. }
  16. func (vp *VPoint) Start() error {
  17. if vp.config.Port <= 0 {
  18. return fmt.Errorf("Invalid port %d", vp.config.Port)
  19. }
  20. vp.connHandler.Listen(vp.config.Port)
  21. return nil
  22. }