WIP: prepare for testing
This commit is contained in:
@@ -18,6 +18,7 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"gitea.suyono.dev/suyono/netbounce/abstract"
|
||||
)
|
||||
|
||||
@@ -59,5 +60,5 @@ func (t tcpModule) AsTCP() abstract.TCPConnectionConfig {
|
||||
|
||||
func (t tcpModule) AsUDP() abstract.UDPConnectionConfig {
|
||||
panic(fmt.Errorf("not UDP"))
|
||||
return nil
|
||||
// return nil
|
||||
}
|
||||
|
||||
@@ -18,8 +18,10 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitea.suyono.dev/suyono/netbounce/abstract"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"gitea.suyono.dev/suyono/netbounce/abstract"
|
||||
)
|
||||
|
||||
type udpConfig struct {
|
||||
@@ -30,6 +32,10 @@ type udpConfig struct {
|
||||
Timeout time.Duration `mapstructure:"timeout,30m"`
|
||||
}
|
||||
|
||||
type udpBackendAddr struct {
|
||||
config udpConfig
|
||||
}
|
||||
|
||||
type udpModule struct {
|
||||
config udpConfig
|
||||
}
|
||||
@@ -40,7 +46,7 @@ func (u udpModule) AsUDP() abstract.UDPConnectionConfig {
|
||||
|
||||
func (u udpModule) AsTCP() abstract.TCPConnectionConfig {
|
||||
panic(fmt.Errorf("not UDP"))
|
||||
return nil
|
||||
// return nil
|
||||
}
|
||||
|
||||
func (u udpModule) Name() string {
|
||||
@@ -62,3 +68,15 @@ func (u udpModule) Backend() string {
|
||||
func (u udpModule) Timeout() time.Duration {
|
||||
return u.config.Timeout
|
||||
}
|
||||
|
||||
func (u udpModule) BackendAddr() net.Addr {
|
||||
return udpBackendAddr(u)
|
||||
}
|
||||
|
||||
func (a udpBackendAddr) Network() string {
|
||||
return "udp"
|
||||
}
|
||||
|
||||
func (a udpBackendAddr) String() string {
|
||||
return a.config.Backend
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user