mirror of
https://github.com/go-i2p/go-sam-go.git
synced 2025-06-15 21:28:46 -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 {
|
||||
switch v := value.(type) {
|
||||
case int:
|
||||
return fmt.Sprintf("%s.%s=%d", direction, property, value)
|
||||
return fmt.Sprintf("%s.%s=%d", direction, property, v)
|
||||
case string:
|
||||
return fmt.Sprintf("%s.%s=%s", direction, property, value)
|
||||
return fmt.Sprintf("%s.%s=%s", direction, property, v)
|
||||
case bool:
|
||||
return fmt.Sprintf("%s.%s=%t", direction, property, value)
|
||||
|
||||
return fmt.Sprintf("%s.%s=%t", direction, property, v)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ func TestSetInQuantity(t *testing.T) {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
emit := &SAMEmit{I2PConfig: I2PConfig{}}
|
||||
err := SetInQuantity(tt.input)(emit)
|
||||
|
||||
if err != nil {
|
||||
if !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) {
|
||||
emit := &SAMEmit{I2PConfig: I2PConfig{}}
|
||||
err := SetOutQuantity(tt.input)(emit)
|
||||
|
||||
if err != nil {
|
||||
if !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) {
|
||||
log.WithField("address", address).Debug("Creating new full SAMResolver")
|
||||
var s SAMResolver
|
||||
//var err error
|
||||
// var err error
|
||||
sam, err := NewSAM(address)
|
||||
s.SAM = sam
|
||||
if err != nil {
|
||||
|
@ -112,21 +112,27 @@ func (bs *BaseSession) Close() error { return bs.conn.Close() }
|
||||
func (bs *BaseSession) LocalAddr() net.Addr {
|
||||
return bs.conn.LocalAddr()
|
||||
}
|
||||
|
||||
func (bs *BaseSession) RemoteAddr() net.Addr {
|
||||
return bs.conn.RemoteAddr()
|
||||
}
|
||||
|
||||
func (bs *BaseSession) SetDeadline(t time.Time) error {
|
||||
return bs.conn.SetDeadline(t)
|
||||
}
|
||||
|
||||
func (bs *BaseSession) SetReadDeadline(t time.Time) error {
|
||||
return bs.conn.SetReadDeadline(t)
|
||||
}
|
||||
|
||||
func (bs *BaseSession) SetWriteDeadline(t time.Time) error {
|
||||
return bs.conn.SetWriteDeadline(t)
|
||||
}
|
||||
|
||||
func (bs *BaseSession) From() string {
|
||||
return bs.SAM.Fromport
|
||||
}
|
||||
|
||||
func (bs *BaseSession) To() string {
|
||||
return bs.SAM.Toport
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import (
|
||||
"github.com/go-i2p/go-sam-go/common"
|
||||
)
|
||||
|
||||
var ss common.Session = &StreamSession{}
|
||||
var sl net.Listener = &StreamListener{}
|
||||
var sc net.Conn = &StreamConn{}
|
||||
var (
|
||||
ss common.Session = &StreamSession{}
|
||||
sl net.Listener = &StreamListener{}
|
||||
sc net.Conn = &StreamConn{}
|
||||
)
|
||||
|
Reference in New Issue
Block a user