func (cons *Socket) Configure(conf core.PluginConfigReader) {
	if len(cons.acknowledge) > 0 && cons.protocol == "udp" {
		conf.Errors.Pushf("UDP sockets do not support acknowledgment.")
	}
	address := conf.GetString("Address", "tcp://0.0.0.0:5880")
	cons.protocol, cons.address = tnet.ParseAddress(address, "tcp")
	cons.flags = 0
	partitioner := conf.GetString("Partitioner", "delimiter")
	switch strings.ToLower(partitioner) {
	case "binary_be":
		cons.flags |= tio.BufferedReaderFlagBigEndian
		fallthrough
	case "binary", "binary_le":
		cons.flags |= tio.BufferedReaderFlagEverything
		switch conf.GetInt("Size", 4) {
		case 1:
			cons.flags |= tio.BufferedReaderFlagMLE8
		case 2:
			cons.flags |= tio.BufferedReaderFlagMLE16
		case 4:
			cons.flags |= tio.BufferedReaderFlagMLE32
		case 8:
			cons.flags |= tio.BufferedReaderFlagMLE64
		default:
			conf.Errors.Pushf("Size only supports the value 1,2,4 and 8")
		}
	case "fixed":
		cons.flags |= tio.BufferedReaderFlagMLEFixed
		cons.offset = int(conf.GetInt("Size", 1))
	case "ascii":
		cons.flags |= tio.BufferedReaderFlagMLE
	case "delimiter":
	default:
		conf.Errors.Pushf("Unknown partitioner: %s", partitioner)
	}
}
Configure initializes this consumer with values from a plugin config.
package consumer
import (
	"fmt"
	"io"
	"net"
	"os"
	"strings"
	"sync"
	"time"
	"github.com/trivago/tgo"
	"github.com/trivago/tgo/tio"
	"github.com/trivago/tgo/tnet"
	"gollum/core"
)
const (
	socketBufferGrowSize = 256
)
type Socket struct {
	sync.Mutex
	core.SimpleConsumer `gollumdoc:"embed_type"`
	listener      io.Closer
	protocol      string
	address       string
	acknowledge   string        `config:"Acknowledge" default:""`
	delimiter     string        `config:"Delimiter" default:"\n"`
	reconnectTime time.Duration `config:"ReconnectAfterSec" default:"2" metric:"sec"`
	ackTimeout    time.Duration `config:"AckTimeoutSec" default:"1" metric:"sec"`
	readTimeout   time.Duration `config:"ReadTimeoutSec" default:"2" metric:"sec"`
	fileFlags     os.FileMode   `config:"Permissions" default:"0770"`
	offset        int           `config:"Offset" default:"0"`
	flags         tio.BufferedReaderFlags
	clearSocket   bool `config:"RemoveOldSocket" default:"true"`
}
func init() {
	core.TypeRegistry.Register(Socket{})
}