Refactor api

This commit is contained in:
世界 2022-08-14 11:52:38 +08:00
parent d378b6ca53
commit b828f01643
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
15 changed files with 357 additions and 138 deletions

View file

@ -12,12 +12,6 @@ import (
var _ GVisorTun = (*NativeTun)(nil)
func (t *NativeTun) NewEndpoint() (stack.LinkEndpoint, error) {
session, err := t.adapter.StartSession(0x800000)
if err != nil {
return nil, err
}
t.session = session
t.readWait = session.ReadWaitEvent()
return &WintunEndpoint{tun: t}, nil
}
@ -29,7 +23,7 @@ type WintunEndpoint struct {
}
func (e *WintunEndpoint) MTU() uint32 {
return e.tun.mtu
return e.tun.options.MTU
}
func (e *WintunEndpoint) MaxHeaderLength() uint16 {