Define tunnel errors
This commit is contained in:
		| @@ -384,7 +384,7 @@ func (t *tun) process() { | ||||
| 				// if the link is not connected skip it | ||||
| 				if !connected { | ||||
| 					log.Debugf("Link for node %s not connected", id) | ||||
| 					err = errors.New("link not connected") | ||||
| 					err = ErrLinkDisconnected | ||||
| 					continue | ||||
| 				} | ||||
|  | ||||
| @@ -392,14 +392,14 @@ func (t *tun) process() { | ||||
| 				// and the message is being sent outbound via | ||||
| 				// a dialled connection don't use this link | ||||
| 				if loopback && msg.outbound { | ||||
| 					err = errors.New("link is loopback") | ||||
| 					err = ErrLinkLoopback | ||||
| 					continue | ||||
| 				} | ||||
|  | ||||
| 				// if the message was being returned by the loopback listener | ||||
| 				// send it back up the loopback link only | ||||
| 				if msg.loopback && !loopback { | ||||
| 					err = errors.New("link is not loopback") | ||||
| 					err = ErrLinkRemote | ||||
| 					continue | ||||
| 				} | ||||
|  | ||||
| @@ -414,7 +414,7 @@ func (t *tun) process() { | ||||
| 					// this is where we explicitly set the link | ||||
| 					// in a message received via the listen method | ||||
| 					if len(msg.link) > 0 && id != msg.link { | ||||
| 						err = errors.New("link not found") | ||||
| 						err = ErrLinkNotFound | ||||
| 						continue | ||||
| 					} | ||||
| 				} | ||||
|   | ||||
| @@ -26,6 +26,12 @@ var ( | ||||
| 	ErrDiscoverChan = errors.New("failed to discover channel") | ||||
| 	// ErrLinkNotFound is returned when a link is specified at dial time and does not exist | ||||
| 	ErrLinkNotFound = errors.New("link not found") | ||||
| 	// ErrLinkDisconnected is returned when a link we attempt to send to is disconnected | ||||
| 	ErrLinkDisconnected = errors.New("link not connected") | ||||
| 	// ErrLinkLoppback is returned when attempting to send an outbound message over loopback link | ||||
| 	ErrLinkLoopback = errors.New("link is loopback") | ||||
| 	// ErrLinkRemote is returned when attempting to send a loopback message over remote link | ||||
| 	ErrLinkRemote = errors.New("link is remote") | ||||
| 	// ErrReadTimeout is a timeout on session.Recv | ||||
| 	ErrReadTimeout = errors.New("read timeout") | ||||
| 	// ErrDecryptingData is for when theres a nonce error | ||||
|   | ||||
		Reference in New Issue
	
	Block a user