func New()

in pkg/output/shipper/shipper.go [32:52]


func New(cfg *ucfg.Config) (s output.Output, err error) {
	c := defaultConfig()
	if err := cfg.Unpack(&c); err != nil {
		return nil, err
	}
	opts := defaultDialOptions()
	ctx, cancel := context.WithTimeout(context.Background(), c.Timeout)
	defer cancel()
	conn, err := grpc.DialContext(ctx, c.Address, opts...)
	if err != nil {
		return nil, fmt.Errorf("error dialing %s: %w", c.Address, err)
	}
	client := sc.NewProducerClient(conn)

	so := &ShipperOutput{
		client: client,
		conn:   conn,
		config: c,
	}
	return so, nil
}