Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't expose device fd on windows #60

Closed
chengxuncc opened this issue Mar 31, 2019 · 3 comments · May be fixed by #62
Closed

Can't expose device fd on windows #60

chengxuncc opened this issue Mar 31, 2019 · 3 comments · May be fixed by #62

Comments

@chengxuncc
Copy link

chengxuncc commented Mar 31, 2019

I can't expose fd on windows like #7 before.

When I use type assertion, and get this:
panic: interface conversion: io.ReadWriteCloser is *water.wfile, not *os.File
Environment:
windows10, golang 1.12, amd64

@songgao
Copy link
Owner

songgao commented Mar 31, 2019

@chengxuncc Thanks for the issue. Could you explain what you are using the FD for on Windows? Ideally operations that require direct access to the FD (or Handle on Windows) would be included in this package.

@chengxuncc
Copy link
Author

I just run this code on windows:

package main

import (
    "log"
    "os"

    "github.com/songgao/water"
)

func main() {
    ifce, err := water.NewTUN("haha")
    if err != nil {
        log.Fatalf("creating TUN interface error: %v\n", err)
    }
    log.Printf("file fd: %d\n", ifce.ReadWriteCloser.(*os.File).Fd())
}

Originally posted by @songgao in #7 (comment)

I use the FD to configure dhcp IP and dns, which can also be implemented by netsh or some ways else, but winodws can show notifications that IP was allocated on device in the FD way.

@songgao
Copy link
Owner

songgao commented Apr 2, 2019

Interesting. I'll put up a PR to add a Sys() method for that. Thanks for bringing it up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants