Commit baada7f6 authored by Janos Guljas's avatar Janos Guljas

Add pingpong mock

parent ff400f66
// Copyright 2020 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package mock
import (
"context"
"time"
)
type Service struct {
pingFunc func(ctx context.Context, address string, msgs ...string) (rtt time.Duration, err error)
}
func New(pingFunc func(ctx context.Context, address string, msgs ...string) (rtt time.Duration, err error)) *Service {
return &Service{pingFunc: pingFunc}
}
func (s *Service) Ping(ctx context.Context, address string, msgs ...string) (rtt time.Duration, err error) {
return s.pingFunc(ctx, address, msgs...)
}
......@@ -21,6 +21,10 @@ const (
streamVersion = "1.0.0"
)
type Interface interface {
Ping(ctx context.Context, address string, msgs ...string) (rtt time.Duration, err error)
}
type Service struct {
streamer p2p.Streamer
logger Logger
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment