mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 14:45:07 +03:00
Merge pull request #474 from neilalexander/gomobile
Various API changes and simplifications to fix mobile builds
This commit is contained in:
commit
7c4c1558ff
19 changed files with 87 additions and 659 deletions
|
@ -59,7 +59,7 @@ func (c *cryptokey) init(tun *TunAdapter) {
|
|||
// Configure the CKR routes - this must only ever be called from the router
|
||||
// goroutine, e.g. through router.doAdmin
|
||||
func (c *cryptokey) configure() error {
|
||||
current, _ := c.tun.config.Get()
|
||||
current := c.tun.config.GetCurrent()
|
||||
|
||||
// Set enabled/disabled state
|
||||
c.setEnabled(current.TunnelRouting.Enable)
|
||||
|
|
|
@ -108,10 +108,10 @@ func (s *tunConn) writer() error {
|
|||
} else {
|
||||
s.tun.log.Errorln(s.conn.String(), "TUN/TAP generic write error:", err)
|
||||
}
|
||||
} else if ispackettoobig, maxsize := e.PacketTooBig(); ispackettoobig {
|
||||
} else if e.PacketTooBig() {
|
||||
// TODO: This currently isn't aware of IPv4 for CKR
|
||||
ptb := &icmp.PacketTooBig{
|
||||
MTU: int(maxsize),
|
||||
MTU: int(e.PacketMaximumSize()),
|
||||
Data: b[:900],
|
||||
}
|
||||
if packet, err := CreateICMPv6(b[8:24], b[24:40], ipv6.ICMPTypePacketTooBig, 0, ptb); err == nil {
|
||||
|
|
|
@ -119,7 +119,7 @@ func (tun *TunAdapter) Init(config *config.NodeState, log *log.Logger, listener
|
|||
// Start the setup process for the TUN/TAP adapter. If successful, starts the
|
||||
// read/write goroutines to handle packets on that interface.
|
||||
func (tun *TunAdapter) Start() error {
|
||||
current, _ := tun.config.Get()
|
||||
current := tun.config.GetCurrent()
|
||||
if tun.config == nil || tun.listener == nil || tun.dialer == nil {
|
||||
return errors.New("No configuration available to TUN/TAP")
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
// +build mobile
|
||||
|
||||
package tuntap
|
||||
|
||||
// This is to catch unsupported platforms
|
||||
// If your platform supports tun devices, you could try configuring it manually
|
||||
|
||||
// Creates the TUN/TAP adapter, if supported by the Water library. Note that
|
||||
// no guarantees are made at this point on an unsupported platform.
|
||||
func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int) error {
|
||||
tun.mtu = getSupportedMTU(mtu)
|
||||
return tun.setupAddress(addr)
|
||||
}
|
||||
|
||||
// We don't know how to set the IPv6 address on an unknown platform, therefore
|
||||
// write about it to stdout and don't try to do anything further.
|
||||
func (tun *TunAdapter) setupAddress(addr string) error {
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue