Git Product home page Git Product logo

gontpd's Introduction

GoNTPd

GoDoc Build Status

GoNTPd is an experimental high-performance NTP server written in Go. It does NOT implement a full NTP client and relies on another NTP client and server to be running on the system instead. It periodically updates its state to mirror the real NTP client/server and uses multiple threads to serve the current system time. Inspired by rsntp

Install

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

Run

gontpd -c config.yml

Config

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

# worker_num: goroutines per connection
worker_num: 1

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

# peer_list: upstream peer list that sync to
up_state: 127.0.0.1:123
up_state_sec: 16

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

Operation

iptables

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

sysctl

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

Performance

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

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.