fieldalignment of all structs to save memory

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-04-27 08:32:47 +03:00
parent ee11f39a2f
commit 86626c5922
78 changed files with 343 additions and 410 deletions

View File

@@ -30,8 +30,10 @@ type tunEvent struct {
}
// used to access tunnel from options context
type tunnelKey struct{}
type tunnelAddr struct{}
type (
tunnelKey struct{}
tunnelAddr struct{}
)
func (t *tunBroker) Init(opts ...broker.Option) error {
for _, o := range opts {

View File

@@ -34,8 +34,8 @@ type Options struct {
Token string
// Name holds the tunnel name
Name string
// Id holds the tunnel id
Id string
// ID holds the tunnel id
ID string
// Address holds the tunnel address
Address string
// Nodes holds the tunnel nodes
@@ -68,10 +68,10 @@ type ListenOptions struct {
Timeout time.Duration
}
// Id sets the tunnel id
func Id(id string) Option {
// ID sets the tunnel id
func ID(id string) Option {
return func(o *Options) {
o.Id = id
o.ID = id
}
}
@@ -164,7 +164,7 @@ func DialWait(b bool) DialOption {
// NewOptions returns router default options with filled values
func NewOptions(opts ...Option) Options {
options := Options{
Id: uuid.New().String(),
ID: uuid.New().String(),
Address: DefaultAddress,
Token: DefaultToken,
Logger: logger.DefaultLogger,

View File

@@ -87,7 +87,7 @@ func NewTransport(opts ...transport.Option) transport.Transport {
}
// initialise
//t.Init(opts...)
// t.Init(opts...)
return t
}

View File

@@ -9,10 +9,8 @@ import (
"github.com/unistack-org/micro/v3/network/transport"
)
var (
// DefaultTunnel contains default tunnel implementation
DefaultTunnel Tunnel
)
// DefaultTunnel contains default tunnel implementation
var DefaultTunnel Tunnel
const (
// Unicast send over one link