Cosmos Nicolaou | ef323db | 2014-09-07 22:13:28 -0700 | [diff] [blame] | 1 | package profiles |
| 2 | |
| 3 | import ( |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame] | 4 | "veyron.io/veyron/veyron2" |
| 5 | "veyron.io/veyron/veyron2/config" |
Cosmos Nicolaou | 767b62d | 2014-09-19 13:58:40 -0700 | [diff] [blame] | 6 | "veyron.io/veyron/veyron2/ipc" |
Cosmos Nicolaou | ef323db | 2014-09-07 22:13:28 -0700 | [diff] [blame] | 7 | |
Jiri Simsa | 519c507 | 2014-09-17 21:37:57 -0700 | [diff] [blame] | 8 | "veyron.io/veyron/veyron/profiles/internal" |
Cosmos Nicolaou | ef323db | 2014-09-07 22:13:28 -0700 | [diff] [blame] | 9 | ) |
| 10 | |
Cosmos Nicolaou | d6c3c9c | 2014-09-30 15:42:53 -0700 | [diff] [blame] | 11 | // LocalListenSpec is a ListenSpec for 127.0.0.1. |
| 12 | var LocalListenSpec = &ipc.ListenSpec{ |
Cosmos Nicolaou | 767b62d | 2014-09-19 13:58:40 -0700 | [diff] [blame] | 13 | Protocol: "tcp", |
| 14 | Address: "127.0.0.1:0", |
| 15 | AddressChooser: internal.IPAddressChooser, |
| 16 | } |
| 17 | |
Cosmos Nicolaou | ef323db | 2014-09-07 22:13:28 -0700 | [diff] [blame] | 18 | type generic struct{} |
| 19 | |
| 20 | // New returns a new instance of a very generic Profile. It can be used |
| 21 | // as a default by Runtime implementations, in unit tests etc. |
| 22 | func New() veyron2.Profile { |
| 23 | return &generic{} |
| 24 | } |
| 25 | |
| 26 | func (*generic) Name() string { |
| 27 | return "generic" |
| 28 | } |
| 29 | |
| 30 | func (*generic) Runtime() string { |
| 31 | return "" |
| 32 | } |
| 33 | |
| 34 | func (*generic) Platform() *veyron2.Platform { |
| 35 | p, _ := Platform() |
| 36 | return p |
| 37 | } |
| 38 | |
Cosmos Nicolaou | 682d7fd | 2014-09-24 22:54:16 -0700 | [diff] [blame] | 39 | func (g *generic) Init(rt veyron2.Runtime, _ *config.Publisher) error { |
Cosmos Nicolaou | ef323db | 2014-09-07 22:13:28 -0700 | [diff] [blame] | 40 | rt.Logger().VI(1).Infof("%s", g) |
Cosmos Nicolaou | 682d7fd | 2014-09-24 22:54:16 -0700 | [diff] [blame] | 41 | return nil |
Cosmos Nicolaou | ef323db | 2014-09-07 22:13:28 -0700 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | func (g *generic) String() string { |
| 45 | return "generic profile on " + g.Platform().String() |
| 46 | } |