Split set route to Start()

This commit is contained in:
世界 2024-11-06 17:09:04 +08:00
parent 9bcc1ec384
commit 24206c3edd
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
5 changed files with 114 additions and 47 deletions

View file

@ -24,7 +24,7 @@ type DarwinEndpoint struct {
}
func (e *DarwinEndpoint) MTU() uint32 {
return e.tun.mtu
return e.tun.options.MTU
}
func (e *DarwinEndpoint) SetMTU(mtu uint32) {
@ -57,7 +57,7 @@ func (e *DarwinEndpoint) Attach(dispatcher stack.NetworkDispatcher) {
}
func (e *DarwinEndpoint) dispatchLoop() {
packetBuffer := make([]byte, e.tun.mtu+PacketOffset)
packetBuffer := make([]byte, e.tun.options.MTU+PacketOffset)
for {
n, err := e.tun.tunFile.Read(packetBuffer)
if err != nil {