transport

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Copyright 2023 The acquirecloud Authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServerListener

func NewServerListener(cfg Config) (net.Listener, error)

NewServerListener returns net.Listener by the config provided. We have the function separate just in case of we start to support different types of transports like TLS, the job will be done here.

Types

type Config

type Config struct {
	// Network defines the network for a network connection
	Network string // put "tcp" here

	// Address can have an interface for listening. Leave it empty to listen on all interfaces
	Address string

	// Port is the port the server will listen on
	Port int
}

Config provides a network transport configuration

func GetDefaultGRPCConfig

func GetDefaultGRPCConfig() *Config

GetDefaultGRPCConfig returns default GRPC config

func ScanAddr

func ScanAddr(addr string) (Config, error)

ScanAddr turns a string in the format %s:%d into Config object. Network field will be empty

func (*Config) Addr

func (c *Config) Addr() string

Addr returns the address string for the transport

func (*Config) Apply

func (c *Config) Apply(other *Config)

Apply assigns non-nil values from other to c

func (*Config) String

func (c *Config) String() string

String implements fmt.Stringify

Jump to

Keyboard shortcuts

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