mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Fix starting TUN read/write
This commit is contained in:
parent
4c115de633
commit
35173e2388
2 changed files with 15 additions and 6 deletions
|
@ -36,6 +36,15 @@ func (tun *tunDevice) init(core *Core) {
|
|||
tun.icmpv6.init(tun)
|
||||
}
|
||||
|
||||
func (tun *tunDevice) start(ifname string, iftapmode bool, addr string, mtu int) error {
|
||||
if err := tun.setup(ifname, iftapmode, addr, mtu); err != nil {
|
||||
return err
|
||||
}
|
||||
go func() { panic(tun.read()) }()
|
||||
go func() { panic(tun.write()) }()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tun *tunDevice) write() error {
|
||||
for {
|
||||
data := <-tun.recv
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue