From f64d9a01be4d579005ef14df59fdaf57a3082664 Mon Sep 17 00:00:00 2001 From: Antonino Catinello Date: Mon, 16 Sep 2019 11:45:07 +0200 Subject: [PATCH 1/2] Fix for GoDoc Link broken #60 (#66) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e17a0fa..daed083 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -go-syslog [![Build Status](https://travis-ci.org/mcuadros/go-syslog.svg?branch=master)](https://travis-ci.org/mcuadros/go-syslog) [![GoDoc](http://godoc.org/github.com/mcuadros/go-syslog?status.svg)](hhttps://godoc.org/gopkg.in/mcuadros/go-syslog.v2) [![GitHub release](https://img.shields.io/github/release/mcuadros/go-syslog.svg)](https://github.com/mcuadros/go-syslog/releases) +go-syslog [![Build Status](https://travis-ci.org/mcuadros/go-syslog.svg?branch=master)](https://travis-ci.org/mcuadros/go-syslog) [![GoDoc](https://godoc.org/github.com/mcuadros/go-syslog?status.svg)](https://godoc.org/gopkg.in/mcuadros/go-syslog.v2) [![GitHub release](https://img.shields.io/github/release/mcuadros/go-syslog.svg)](https://github.com/mcuadros/go-syslog/releases) ============================== Syslog server library for go, build easy your custom syslog server over UDP, TCP or Unix sockets using RFC3164, RFC6587 or RFC5424 From 6f9fc1a03371148d69a5c32492cc902e3f8827bd Mon Sep 17 00:00:00 2001 From: Nilton Kummer Date: Mon, 30 Mar 2020 02:01:17 -0300 Subject: [PATCH 2/2] feat: export set channel buffer size (#59) --- server.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/server.go b/server.go index 352597b..804386a 100644 --- a/server.go +++ b/server.go @@ -33,6 +33,7 @@ type Server struct { connections []net.PacketConn wait sync.WaitGroup doneTcp chan bool + datagramChannelSize int datagramChannel chan DatagramMessage format format.Format handler Handler @@ -48,7 +49,10 @@ func NewServer() *Server { New: func() interface{} { return make([]byte, 65536) }, - }} + }, + + datagramChannelSize: datagramChannelBufferSize, + } } //Sets the syslog format (RFC3164 or RFC5424 or RFC6587) @@ -71,6 +75,10 @@ func (s *Server) SetTlsPeerNameFunc(tlsPeerNameFunc TlsPeerNameFunc) { s.tlsPeerNameFunc = tlsPeerNameFunc } +func (s *Server) SetDatagramChannelSize(size int) { + s.datagramChannelSize = size +} + // Default TLS peer name function - returns the CN of the certificate func defaultTlsPeerName(tlsConn *tls.Conn) (tlsPeer string, ok bool) { state := tlsConn.ConnectionState() @@ -353,7 +361,7 @@ func (s *Server) goReceiveDatagrams(packetconn net.PacketConn) { } func (s *Server) goParseDatagrams() { - s.datagramChannel = make(chan DatagramMessage, datagramChannelBufferSize) + s.datagramChannel = make(chan DatagramMessage, s.datagramChannelSize) s.wait.Add(1) go func() {