mirror of
https://github.com/go-i2p/go-i2ptunnel.git
synced 2025-06-17 12:28:14 -04:00
Add a way to record and handle errors
This commit is contained in:
@ -46,6 +46,13 @@ type TCPClient struct {
|
||||
i2ptunnel.I2PTunnelStatus
|
||||
// Channel for shutdown signaling
|
||||
done chan struct{}
|
||||
|
||||
// Error history of the tunnel
|
||||
Errors []i2ptunnel.I2PTunnelError
|
||||
}
|
||||
|
||||
func (t *TCPClient) recordError(err error) {
|
||||
t.Errors = append(t.Errors, i2ptunnel.NewError(t, err))
|
||||
}
|
||||
|
||||
// Get the tunnel's I2P address
|
||||
@ -55,7 +62,10 @@ func (t *TCPClient) Address() string {
|
||||
|
||||
// Get the tunnel's error message
|
||||
func (t *TCPClient) Error() error {
|
||||
panic("unimplemented")
|
||||
if len(t.Errors) > 0 {
|
||||
return t.Errors[len(t.Errors)-1]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get the tunnel's local host:port
|
||||
|
@ -40,6 +40,13 @@ type TCPServer struct {
|
||||
limitedlistener.LimitedConfig
|
||||
// Channel for shutdown signaling
|
||||
done chan struct{}
|
||||
|
||||
// Error history of the tunnel
|
||||
Errors []i2ptunnel.I2PTunnelError
|
||||
}
|
||||
|
||||
func (t *TCPServer) recordError(err error) {
|
||||
t.Errors = append(t.Errors, i2ptunnel.NewError(t, err))
|
||||
}
|
||||
|
||||
// Get the tunnel's I2P address
|
||||
@ -49,7 +56,10 @@ func (t *TCPServer) Address() string {
|
||||
|
||||
// Get the tunnel's error message
|
||||
func (t *TCPServer) Error() error {
|
||||
panic("unimplemented")
|
||||
if len(t.Errors) > 0 {
|
||||
return t.Errors[len(t.Errors)-1]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get the tunnel's local host:port
|
||||
|
@ -48,6 +48,13 @@ type UDPClient struct {
|
||||
i2ptunnel.I2PTunnelStatus
|
||||
// Channel for shutdown signaling
|
||||
done chan struct{}
|
||||
|
||||
// Error history of the tunnel
|
||||
Errors []i2ptunnel.I2PTunnelError
|
||||
}
|
||||
|
||||
func (u *UDPClient) recordError(err error) {
|
||||
u.Errors = append(u.Errors, i2ptunnel.NewError(u, err))
|
||||
}
|
||||
|
||||
// Get the tunnel's I2P address
|
||||
@ -57,7 +64,10 @@ func (u *UDPClient) Address() string {
|
||||
|
||||
// Get the tunnel's error message
|
||||
func (u *UDPClient) Error() error {
|
||||
panic("unimplemented")
|
||||
if len(u.Errors) > 0 {
|
||||
return u.Errors[len(u.Errors)-1]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get the tunnel's local host:port
|
||||
|
@ -48,6 +48,13 @@ type UDPServer struct {
|
||||
i2ptunnel.I2PTunnelStatus
|
||||
// Channel for shutdown signaling
|
||||
done chan struct{}
|
||||
|
||||
// Error history of the tunnel
|
||||
Errors []i2ptunnel.I2PTunnelError
|
||||
}
|
||||
|
||||
func (u *UDPServer) recordError(err error) {
|
||||
u.Errors = append(u.Errors, i2ptunnel.NewError(u, err))
|
||||
}
|
||||
|
||||
// Get the tunnel's I2P address
|
||||
@ -57,7 +64,10 @@ func (u *UDPServer) Address() string {
|
||||
|
||||
// Get the tunnel's error message
|
||||
func (u *UDPServer) Error() error {
|
||||
panic("unimplemented")
|
||||
if len(u.Errors) > 0 {
|
||||
return u.Errors[len(u.Errors)-1]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get the tunnel's local host:port
|
||||
|
Reference in New Issue
Block a user