| // Package gce provides a Profile for Google Compute Engine and should be |
| // used by binaries that only ever expect to be run on GCE. |
| "veyron/profiles/internal/gce" |
| rt.RegisterProfile(&profile{}) |
| func (p *profile) Name() string { |
| func (p *profile) Runtime() string { |
| func (p *profile) Platform() *veyron2.Platform { |
| platform, _ := profiles.Platform() |
| func (p *profile) String() string { |
| return "net " + p.Platform().String() |
| func (p *profile) AddressChooser() veyron2.AddressChooser { |
| return func(network string, addrs []net.Addr) (net.Addr, error) { |
| return p.publicAddress, nil |
| func (p *profile) Init(rt veyron2.Runtime, publisher *config.Publisher) { |
| // TODO(cnicolaou): add error return to init |
| //return fmt.Errorf("GCE profile used on a non-GCE system") |
| if ip, err := gce.ExternalIPAddress(); err != nil { |
| // TODO(cnicolaou): add error return to init |
| p.publicAddress = &net.IPAddr{IP: ip} |