Giter VIP home page Giter VIP logo

gontpd's Introduction

GoNTPd

GoDoc Build Status

A high performance NTP daemon written in Go.

Only support Linux

Install or Build

# require go1.11
go get github.com/mengzhuo/gontpd/cmd/gontpd

or

# require fpm
./make.sh #  build debian package your

Run

gontpd -c config.yml

Config

# listen: gontpd service listen port (UDP)
listen: ':123'

# force_update: force update time if offset is over 128ms or terminal processs
force_update: true

# worker_num: goroutines per connection
worker_num: 1

# conn_num: numbers of connections
conn_num: 1

# rate: LRU size of rate limmiter
# if drop is true, limmiter will drop the client request instead of sending RATE KoD response to client.
rate_size: 8196
rate_drop: true

# metric: prometheus stat listen port
metric: ':7370'

# geo_db: MaxMind GeoLite2 DB path, it won't stat CountryCode is empty
# NOTE: This will cause high CPU usage, use with caution
geo_db: 

# max/min poll interval seconds (log2) to upstream peer
# i.e. 10 = 1024 seconds
max_poll: 9
min_poll: 4

# peer_list: upstream peer list that sync to
peer_list:
    - time1.apple.com
    - time2.apple.com
    - time3.apple.com
    - time4.apple.com

# max_std: maximum standard deviation of peer that we consider as a good peer.
max_std: 50ms

# drop_cidr: remote address within this list will be drop
# suggest to drop private net request(mostly are spoof request)
drop_cidr:
    - "192.168.0.0/16"
    - "172.16.0.0/12"
    - "10.0.0.0/8"
    - "100.64.0.0/10"

Operation

iptables

-t raw -A PREROUTING -p udp -m udp --dport 123 -j NOTRACK
-t raw -A OUTPUT -p udp -m udp --sport 123 -j NOTRACK

sysctl

net.core.rmem_default = 512992
net.core.rmem_max = 512992
net.core.wmem_default = 512992
net.core.wmem_max = 512992

Performance

Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
~180kpps @ GOMAXPROCS=1

gontpd's People

Contributors

mengzhuo avatar maurorappa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.