rsocket_transport_quic

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

rsocket-transport-quic

QUIC transport for rsocket-go.

Quick Start

Start Echo Server

package main

import (
	"context"
	"log"

	rtq "github.com/ngyewch/rsocket-transport-quic"
	"github.com/rsocket/rsocket-go"
	"github.com/rsocket/rsocket-go/payload"
	"github.com/rsocket/rsocket-go/rx/mono"
)

func main() {
	err := rsocket.Receive().
		Acceptor(func(ctx context.Context, setup payload.SetupPayload, sendingSocket rsocket.CloseableRSocket) (responder rsocket.RSocket, err error) {
			responder = rsocket.NewAbstractSocket(
				rsocket.RequestResponse(func(request payload.Payload) mono.Mono {
					return mono.Just(request)
				}),
			)
			return
		}).
		Transport(rtq.Server().SetAddr(":12345").Build()).
		Serve(context.Background())
	log.Fatalln(err)
}

Client

package main

import (
	"context"
	"log"

	rtq "github.com/ngyewch/rsocket-transport-quic"
	"github.com/rsocket/rsocket-go"
	"github.com/rsocket/rsocket-go/payload"
)

func main() {
	client, err := rsocket.Connect().
		Transport(rtq.Client().SetAddr("127.0.0.1:12345").Build()).
		Start(context.Background())

	if err != nil {
		panic(err)
	}
	defer client.Close()

	res, err := client.RequestResponse(payload.NewString("hello world", "rsocket")).Block(context.Background())
	if err != nil {
		panic(err)
	}
	log.Println("response:", res.DataUTF8())
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientBuilder

type ClientBuilder struct {
	// contains filtered or unexported fields
}

func Client

func Client() *ClientBuilder

func (*ClientBuilder) Build

func (*ClientBuilder) SetAddr

func (q *ClientBuilder) SetAddr(addr string) *ClientBuilder

func (*ClientBuilder) SetHostAndPort

func (q *ClientBuilder) SetHostAndPort(host string, port int) *ClientBuilder

func (*ClientBuilder) SetTLSConfig

func (q *ClientBuilder) SetTLSConfig(c *tls.Config) *ClientBuilder

type ServerBuilder

type ServerBuilder struct {
	// contains filtered or unexported fields
}

func Server

func Server() *ServerBuilder

func (*ServerBuilder) Build

func (*ServerBuilder) SetAddr

func (q *ServerBuilder) SetAddr(addr string) *ServerBuilder

func (*ServerBuilder) SetHostAndPort

func (q *ServerBuilder) SetHostAndPort(host string, port int) *ServerBuilder

func (*ServerBuilder) SetTLSConfig

func (q *ServerBuilder) SetTLSConfig(c *tls.Config) *ServerBuilder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL