diff --git a/hopper.go b/hopper.go index 81b06ce..c1fa8a2 100644 --- a/hopper.go +++ b/hopper.go @@ -55,6 +55,10 @@ const ( mtuLimit = 1500 ) +var ( + errNoNextHop = errors.New("no next hop provided") +) + type ( // OnClientInCallback is a callback function that processes incoming packets from clients OnClientInCallback func(client net.Addr, in []byte) (out []byte) @@ -119,6 +123,10 @@ func ListenWithOptions(laddr string, return nil, errors.WithStack(err) } + if len(nexthops) == 0 { + return nil, errors.WithStack(errNoNextHop) + } + err = conn.SetReadBuffer(sockbuf) if err != nil { return nil, errors.WithStack(err)