mirror of
https://github.com/go-i2p/go-sam-go.git
synced 2025-07-19 10:35:42 -04:00
fmt
This commit is contained in:
@@ -322,12 +322,11 @@ func (f *I2PConfig) DoZero() string {
|
|||||||
func (f *I2PConfig) formatConfigPair(direction, property string, value interface{}) string {
|
func (f *I2PConfig) formatConfigPair(direction, property string, value interface{}) string {
|
||||||
switch v := value.(type) {
|
switch v := value.(type) {
|
||||||
case int:
|
case int:
|
||||||
return fmt.Sprintf("%s.%s=%d", direction, property, value)
|
return fmt.Sprintf("%s.%s=%d", direction, property, v)
|
||||||
case string:
|
case string:
|
||||||
return fmt.Sprintf("%s.%s=%s", direction, property, value)
|
return fmt.Sprintf("%s.%s=%s", direction, property, v)
|
||||||
case bool:
|
case bool:
|
||||||
return fmt.Sprintf("%s.%s=%t", direction, property, value)
|
return fmt.Sprintf("%s.%s=%t", direction, property, v)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,6 @@ func TestSetInQuantity(t *testing.T) {
|
|||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
emit := &SAMEmit{I2PConfig: I2PConfig{}}
|
emit := &SAMEmit{I2PConfig: I2PConfig{}}
|
||||||
err := SetInQuantity(tt.input)(emit)
|
err := SetInQuantity(tt.input)(emit)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !tt.wantErr {
|
if !tt.wantErr {
|
||||||
t.Errorf("SetInQuantity() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("SetInQuantity() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
@@ -53,7 +52,6 @@ func TestSetOutQuantity(t *testing.T) {
|
|||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
emit := &SAMEmit{I2PConfig: I2PConfig{}}
|
emit := &SAMEmit{I2PConfig: I2PConfig{}}
|
||||||
err := SetOutQuantity(tt.input)(emit)
|
err := SetOutQuantity(tt.input)(emit)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !tt.wantErr {
|
if !tt.wantErr {
|
||||||
t.Errorf("SetOutQuantity() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("SetOutQuantity() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
@@ -19,7 +19,7 @@ func NewSAMResolver(parent *SAM) (*SAMResolver, error) {
|
|||||||
func NewFullSAMResolver(address string) (*SAMResolver, error) {
|
func NewFullSAMResolver(address string) (*SAMResolver, error) {
|
||||||
log.WithField("address", address).Debug("Creating new full SAMResolver")
|
log.WithField("address", address).Debug("Creating new full SAMResolver")
|
||||||
var s SAMResolver
|
var s SAMResolver
|
||||||
//var err error
|
// var err error
|
||||||
sam, err := NewSAM(address)
|
sam, err := NewSAM(address)
|
||||||
s.SAM = sam
|
s.SAM = sam
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -112,21 +112,27 @@ func (bs *BaseSession) Close() error { return bs.conn.Close() }
|
|||||||
func (bs *BaseSession) LocalAddr() net.Addr {
|
func (bs *BaseSession) LocalAddr() net.Addr {
|
||||||
return bs.conn.LocalAddr()
|
return bs.conn.LocalAddr()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *BaseSession) RemoteAddr() net.Addr {
|
func (bs *BaseSession) RemoteAddr() net.Addr {
|
||||||
return bs.conn.RemoteAddr()
|
return bs.conn.RemoteAddr()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *BaseSession) SetDeadline(t time.Time) error {
|
func (bs *BaseSession) SetDeadline(t time.Time) error {
|
||||||
return bs.conn.SetDeadline(t)
|
return bs.conn.SetDeadline(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *BaseSession) SetReadDeadline(t time.Time) error {
|
func (bs *BaseSession) SetReadDeadline(t time.Time) error {
|
||||||
return bs.conn.SetReadDeadline(t)
|
return bs.conn.SetReadDeadline(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *BaseSession) SetWriteDeadline(t time.Time) error {
|
func (bs *BaseSession) SetWriteDeadline(t time.Time) error {
|
||||||
return bs.conn.SetWriteDeadline(t)
|
return bs.conn.SetWriteDeadline(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *BaseSession) From() string {
|
func (bs *BaseSession) From() string {
|
||||||
return bs.SAM.Fromport
|
return bs.SAM.Fromport
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bs *BaseSession) To() string {
|
func (bs *BaseSession) To() string {
|
||||||
return bs.SAM.Toport
|
return bs.SAM.Toport
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,8 @@ import (
|
|||||||
"github.com/go-i2p/go-sam-go/common"
|
"github.com/go-i2p/go-sam-go/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ss common.Session = &StreamSession{}
|
var (
|
||||||
var sl net.Listener = &StreamListener{}
|
ss common.Session = &StreamSession{}
|
||||||
var sc net.Conn = &StreamConn{}
|
sl net.Listener = &StreamListener{}
|
||||||
|
sc net.Conn = &StreamConn{}
|
||||||
|
)
|
||||||
|
Reference in New Issue
Block a user