secure/bidirule: fix bug/different semantics

This also fixes issues in secure/precis (the tests make a lot more
sense now).

- Rules only apply to Bidi Domain names. Currently the user had
to test this. This test is now embedded in the bidi test.

- Direction* now reports the direction as defined in the RFC,
instead of using the Unicode definition.

- Added Valid and ValidString functions. This is much more useful
and intuitive if the user does not require a transformer.

Fixes golang/go#17383

Change-Id: Id7be15e48bbf36581ce23347575eb88226e12841
Reviewed-on: https://go-review.googlesource.com/30553
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
3 files changed