Commit graph

117 commits

Author SHA1 Message Date
Michael Marineau
03222d488c client: support sending events asynchronously
Makes blocking and waiting for success/error optional, also allows
concurrent use of the rest of the client while events are sent.
2017-06-09 18:40:25 -07:00
Michael Marineau
c42bec118e client: support runtime changes of app id 2017-06-07 11:29:02 -07:00
Michael Marineau
3b5d143dc5 client: add application oem attribute 2017-06-07 11:29:02 -07:00
Yifan Gu
b2ea5e0e78 Merge pull request #25 from marineam/timer
Fuzzy timer for exponential backoff and update polling
2017-06-05 13:45:48 -07:00
Michael Marineau
bd1ae5648e client: add rough example for using the client 2017-06-05 13:23:32 -07:00
Michael Marineau
1b026dfef5 client: add fuzzy timer for update check and ping interval
Uses the same timing parameters as update_engine.
2017-06-02 18:44:29 -07:00
Michael Marineau
c88c5916bb client: implement exponential backoff on temporary network errors
Uses a fuzzy timer to reduce chance of multiple clients synchronizing.
2017-06-02 18:44:29 -07:00
Michael Marineau
c9e5a6a602 client: define default version as a constant 2017-06-02 18:44:29 -07:00
Michael Marineau
d40844181a client: add fuzzy timer
For randomizing update check intervals and backoff delays to reduce
chance of DoSing the server if lots of clients start together.
2017-06-02 18:42:53 -07:00
Michael Marineau
f8acb2d7b7 Merge pull request #24 from marineam/client
Begin generic omaha client implementation
2017-05-26 13:38:09 -07:00
Michael Marineau
e67d0ff67a README: explain implementation status in more detail 2017-05-25 14:29:35 -07:00
Michael Marineau
73e12a0154 client: add support for machine-wide omaha clients
Uses machine id and boot id for user and session respectively, matching
the existing behavior of update_engine.
2017-05-25 13:57:28 -07:00
Michael Marineau
ad277db627 client: implement event, ping, and updatecheck
For simplicity one request is sent for each event/ping/check for each
application. In the future it would be wise to batch together multiple
events and multiple applications to avoid excessive chatter.
2017-05-25 13:13:10 -07:00
Michael Marineau
5a03e1d183 codes: improve app and update status error messages 2017-05-25 13:13:10 -07:00
Michael Marineau
afab572db3 protocol: change IsMachine flag to int
This flag is a boolean "0" or "1", with "0" as the default so keeping
the "omitempty" xml option is ok.
2017-05-25 13:13:10 -07:00
Michael Marineau
d8ad567e7f protocol: add GetApp helper methods 2017-05-25 13:13:09 -07:00
Michael Marineau
45e1ea6221 client: report sensible errors if response is excessively large or empty 2017-05-25 13:13:09 -07:00
Michael Marineau
e6f3abe15e client: support retrying requests after transient HTTP errors
Wraps failed http.Request objects in a net.Error interface.
2017-05-25 13:13:09 -07:00
Michael Marineau
b8149cc683 client: add extended http client for making omaha api requests
Supports encoding/decoding omaha xml and retrying on transient failures.
2017-05-25 13:13:09 -07:00
Michael Marineau
b2b975be5d client: begin omaha client implementation
This first commit just covers the basic data structures.
2017-05-25 13:13:09 -07:00
Yifan Gu
a81e2c0792 Merge pull request #23 from marineam/trivial
protocol: remove stray Event type
2017-05-05 12:03:41 -07:00
Michael Marineau
036aedf2d7 protocol: remove stray Event type
The Event struct was split into EventRequest and EventResponse back in
75a1125f but the older now unused type was never deleted.
2017-05-05 11:53:52 -07:00
Michael Marineau
d6e8a00feb Merge pull request #22 from marineam/parse
protocol: add ParseRequest and ParseResponse functions
2017-05-05 11:49:06 -07:00
Michael Marineau
3d5d24e0b8 Merge pull request #21 from marineam/trivial
protocol: style fix, use "ID" and "SHA" in identifiers.
2017-05-04 13:52:18 -07:00
Michael Marineau
a6290c1b4f protocol: add ParseRequest and ParseResponse functions
For parsing and verification of of HTTP request and response bodies,
including optional checking the Content-Type field which the handler
previously didn't do.
2017-05-04 13:25:46 -07:00
Michael Marineau
6198ba9443 protocol: style fix, use "ID" and "SHA" in identifiers. 2017-05-04 13:22:27 -07:00
Yifan Gu
773016a0fd Merge pull request #20 from marineam/trivial
Trivial protocol struct updates
2017-05-02 13:38:33 -07:00
Michael Marineau
5f9a499a46 package: fix SHA256 attribute name, now defined by the spec.
The old name was my own extension and unused by anything so there aren't
any compatibility issues here.
2017-05-02 13:15:04 -07:00
Michael Marineau
79e582819b protocol: sort xml attributes
A cosmetic change, though this will change the order in the XML output.
The spec lists fields alphabetically so this makes comparison easier.
2017-05-02 13:07:53 -07:00
Michael Marineau
8e6feed630 Merge pull request #19 from marineam/template
Sync with CoreOS template project
2017-05-02 12:36:35 -07:00
Michael Marineau
c694d6ed59 Merge pull request #18 from marineam/from-mantle
Import omaha updates from mantle
2017-05-02 12:34:24 -07:00
Michael Marineau
9a796427d5 omaha: distinguish zero and unset in ping active days field
Unlike the other fields unset here would mean unknown rather than "0" so
we must distinguish between the two. In the end it isn't very
significant since our update server and none of our clients use these
self-reported active times, exclusively using when pings were received.
2017-04-24 13:05:53 -07:00
Michael Marineau
c7d81825c4 omaha: remove lingering references to mantle 2017-04-24 12:23:53 -07:00
Michael Marineau
4b95d8178b omaha: update upstream doc URL 2017-04-24 12:04:41 -07:00
Michael Marineau
7786cbf0d4 Merge branch 'master' of https://github.com/coreos/template-project 2017-04-21 17:16:37 -07:00
Michael Marineau
acd5c75d52 travis: test against go 1.7 and 1.8 2017-04-21 14:12:44 -07:00
Michael Marineau
4d02220019 omaha: add basic but functional omaha server for testing
This server doesn't care about app id, versions, or really anything.
Once a payload has been set it will use it for all update requests.
2017-04-21 14:12:44 -07:00
Nick Owens
e5eb9eb583 omaha: implement server based on OmahaHandler
As-is this server cannot do much and must be given an Updater
implementation to handle requests. Server.Mux is exposed to in case the
server needs to additional handlers for serving package payloads, etc.
2017-04-21 14:12:44 -07:00
Michael Marineau
f33cb66abb omaha: add complete http handler implementation
The handler is driven by something implementing the 'Updater' interface.
2017-04-21 14:12:44 -07:00
Michael Marineau
2cf1d8f13e omaha: support using status codes as error values 2017-04-21 14:12:44 -07:00
Michael Marineau
5e54ada1e9 omaha: add structure for representing a single app update
The protocol structures are intended for representing a collection of
apps and their updates but for a server's internal API and data store we
need to represent a self-contained app update manifest.
2017-04-21 14:12:44 -07:00
Michael Marineau
5543f86194 omaha: add helper method for computing package metadata 2017-04-21 14:12:44 -07:00
Michael Marineau
f208691b12 omaha: stop wrapping URL slice in a struct
Since splitting request and response structs it is no longer necessary
to work around Go's awkard handling of a `xml:"urls>url"` tag.
2017-04-21 14:12:44 -07:00
Michael Marineau
a3bc668225 omaha: add/fix missing or outdated attributes 2017-04-21 14:12:44 -07:00
Michael Marineau
75a1125f53 omaha: split request and response structures
Despite having common names between the request and response XML
structures the actual values which may appear in them are completely
disjoint. Splitting the types up makes the protocol easier to understand
when reading the code. When applicable, required fields like status are
passed to Add* methods.
2017-04-21 14:12:44 -07:00
Michael Marineau
ec70842bdd omaha: rework/cleanup protocol APIs
- Avoid long argument lists and only pass values that are strictly
   required such as status, fill in all other fields directly instead.
 - Fill OS struct in requests based on local system.
 - Define event and status codes as constants.
 - Misc style tweaks.
2017-04-21 14:12:44 -07:00
Michael Marineau
fef283aeb6 omaha: remove XMLName from nested structures
The special XMLName field is only useful in the top level structs which
need something to attach the lower case tag to. On the rest the default
behavior without XMLName works just fine so it is clutter.

The datastore tags have been dropped too since they are not needed.
2017-04-21 14:12:44 -07:00
Nick Owens
6ab36bd0dc omaha: fix go vet complaints
omaha/protocol_test.go:83: ExampleOmaha_NewResponse refers to unknown identifier: Omaha
omaha/protocol_test.go:134: ExampleOmaha_NewRequest refers to unknown identifier: Omaha
2017-04-21 14:12:44 -07:00
Michael Marineau
8650026537 omaha: update file header style and file names 2017-04-21 14:12:44 -07:00
Michael Marineau
909299725c omaha: embed test data into the test code 2017-04-21 14:12:44 -07:00