mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 06:12:55 +00:00
707221954f
This change adds adds an ability to use different source of time for whisper: when envelope is created it is used to set expiry to track when envelope needs to be expired This time is then used to check validity of the envelope when it is received. Currently If we receive an envelope that is sent from future - peer will get disconnected. If envelope that was received has an expiry less then now it will be simply dropped, if expiry is less than now + 10*2 seconds peer will get dropped. So, it is clear that whisper depends on time. And any time we get a skew with peers that is > 20s reliability will be grealy reduced. In this change another source of time for whisper will be used. This time source will use ntp servers from pool.ntp.org to compute offset. When whisper queries time - this offset will be added/substracted from current time. Query is executed every 2 mins, queries 5 different servers, cut offs min and max and the computes mean value. pool.ntp.org is resolved to different servers and according to documentation you will rarely hit the same. Closes: #687
45 lines
1.7 KiB
Go
45 lines
1.7 KiB
Go
// Copyright 2014 The Go 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 ipv4
|
|
|
|
import "golang.org/x/net/internal/socket"
|
|
|
|
// Sticky socket options
|
|
const (
|
|
ssoTOS = iota // header field for unicast packet
|
|
ssoTTL // header field for unicast packet
|
|
ssoMulticastTTL // header field for multicast packet
|
|
ssoMulticastInterface // outbound interface for multicast packet
|
|
ssoMulticastLoopback // loopback for multicast packet
|
|
ssoReceiveTTL // header field on received packet
|
|
ssoReceiveDst // header field on received packet
|
|
ssoReceiveInterface // inbound interface on received packet
|
|
ssoPacketInfo // incbound or outbound packet path
|
|
ssoHeaderPrepend // ipv4 header prepend
|
|
ssoStripHeader // strip ipv4 header
|
|
ssoICMPFilter // icmp filter
|
|
ssoJoinGroup // any-source multicast
|
|
ssoLeaveGroup // any-source multicast
|
|
ssoJoinSourceGroup // source-specific multicast
|
|
ssoLeaveSourceGroup // source-specific multicast
|
|
ssoBlockSourceGroup // any-source or source-specific multicast
|
|
ssoUnblockSourceGroup // any-source or source-specific multicast
|
|
ssoAttachFilter // attach BPF for filtering inbound traffic
|
|
)
|
|
|
|
// Sticky socket option value types
|
|
const (
|
|
ssoTypeIPMreq = iota + 1
|
|
ssoTypeIPMreqn
|
|
ssoTypeGroupReq
|
|
ssoTypeGroupSourceReq
|
|
)
|
|
|
|
// A sockOpt represents a binding for sticky socket option.
|
|
type sockOpt struct {
|
|
socket.Option
|
|
typ int // hint for option value type; optional
|
|
}
|