google / google/gvisor

Compilable for Windows platform for gvisor@go

Open
#11,841 0 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Go
Stars
19.3k
Forks
2k
Avg merge
3d 5h
Merged PRs (30d)
264

Description

### Description

using gvisor@go write a simple program on windows is not compilable

```golang
package main

import (
"gvisor.dev/gvisor/pkg/sentry/socket/netfilter"
"gvisor.dev/gvisor/pkg/tcpip/network/ipv4"
"gvisor.dev/gvisor/pkg/tcpip/network/ipv6"
"gvisor.dev/gvisor/pkg/tcpip/stack"
"gvisor.dev/gvisor/pkg/tcpip/transport/tcp"
"gvisor.dev/gvisor/pkg/tcpip/transport/udp"
)

func main() {

s := stack.New(stack.Options{
NetworkProtocols: []stack.NetworkProtocolFactory{ipv4.NewProtocol, ipv6.NewProtocol},
TransportProtocols: []stack.TransportProtocolFactory{tcp.NewProtocol, udp.NewProtocol},
})

v4NatTable := s.IPTables().GetTable(stack.NATID, false)
v4NatTable.Rules = append(v4NatTable.Rules, stack.Rule{
Filter: stack.IPHeaderFilter{},
Matchers: []stack.Matcher{
&netfilter.UDPMatcher{},
},
})

}
```

with compile error:

```
package test
imports gvisor.dev/gvisor/pkg/sentry/socket/netfilter
imports gvisor.dev/gvisor/pkg/sentry/kernel
imports gvisor.dev/gvisor/pkg/devutil
imports gvisor.dev/gvisor/pkg/lisafs
imports gvisor.dev/gvisor/pkg/fdchannel: build constraints exclude all Go files in C:\Users\test\go\pkg\mod\gvisor.dev\gvisor@v0.0.0-20250617214217-a89622337e05\pkg\fdchannel
package test
imports gvisor.dev/gvisor/pkg/sentry/socket/netfilter
imports gvisor.dev/gvisor/pkg/sentry/kernel
imports gvisor.dev/gvisor/pkg/devutil
imports gvisor.dev/gvisor/pkg/lisafs
imports gvisor.dev/gvisor/pkg/unet
imports gvisor.dev/gvisor/pkg/eventfd
imports gvisor.dev/gvisor/pkg/rawfile: build constraints exclude all Go files in C:\Users\test\go\pkg\mod\gvisor.dev\gvisor@v0.0.0-20250617214217-a89622337e05\pkg\rawfile
package test
imports gvisor.dev/gvisor/pkg/sentry/socket/netfilter
imports gvisor.dev/gvisor/pkg/sentry/kernel
imports gvisor.dev/gvisor/pkg/sentry/fsimpl/kernfs
imports gvisor.dev/gvisor/pkg/sentry/socket/unix/transport
imports gvisor.dev/gvisor/pkg/fdnotifier: build constraints exclude all Go files in C:\Users\test\go\pkg\mod\gvisor.dev\gvisor@v0.0.0-20250617214217-a89622337e05\pkg\fdnotifier

Compilation finished with exit code 1

```

In fact this code does not require any linux feature.

### Is this feature related to a specific bug?

_No response_

### Do you have a specific solution in mind?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.