Struct ServerConfig

Source
pub struct ServerConfig {
Show 22 fields pub application_name: String, pub application_uri: String, pub product_uri: String, pub create_sample_keypair: bool, pub certificate_path: Option<PathBuf>, pub private_key_path: Option<PathBuf>, pub certificate_validation: CertificateValidation, pub pki_dir: PathBuf, pub discovery_server_url: Option<String>, pub tcp_config: TcpConfig, pub limits: Limits, pub locale_ids: Vec<String>, pub user_tokens: BTreeMap<String, ServerUserToken>, pub discovery_urls: Vec<String>, pub default_endpoint: Option<String>, pub endpoints: BTreeMap<String, ServerEndpoint>, pub subscription_poll_interval_ms: u64, pub publish_timeout_default_ms: u64, pub max_timeout_ms: u32, pub max_secure_channel_token_lifetime_ms: u32, pub max_session_timeout_ms: u64, pub diagnostics: bool,
}
Expand description

Server configuration object.

Fields§

§application_name: String

An id for this server

§application_uri: String

A description for this server

§product_uri: String

Product url

§create_sample_keypair: bool

Autocreates public / private keypair if they don’t exist. For testing/samples only since you do not have control of the values

§certificate_path: Option<PathBuf>

Path to a custom certificate, to be used instead of the default .der certificate

§private_key_path: Option<PathBuf>

Path to a custom private key, to be used instead of the default private key

§certificate_validation: CertificateValidation

Checks the certificate’s time validity

§pki_dir: PathBuf

PKI folder, either absolute or relative to executable

§discovery_server_url: Option<String>

Url to a discovery server - adding this string causes the server to assume you wish to register the server with a discovery server.

§tcp_config: TcpConfig

tcp configuration information

§limits: Limits

Server OPA UA limits

§locale_ids: Vec<String>

Supported locale ids

§user_tokens: BTreeMap<String, ServerUserToken>

User tokens

§discovery_urls: Vec<String>

discovery endpoint url which may or may not be the same as the service endpoints below.

§default_endpoint: Option<String>

Default endpoint id

§endpoints: BTreeMap<String, ServerEndpoint>

Endpoints supported by the server

§subscription_poll_interval_ms: u64

Interval in milliseconds between each time the subscriptions are polled.

§publish_timeout_default_ms: u64

Default publish request timeout.

§max_timeout_ms: u32

Max message timeout for non-publish requests. Will not be applied for requests that are handled synchronously. Set to 0 for no timeout, meaning that a timeout will only be applied if the client requests one. If this is greater than zero and the client requests a timeout of 0, this will be used.

§max_secure_channel_token_lifetime_ms: u32

Maximum lifetime of secure channel tokens. The client will request a number, this just sets an upper limit on that value. Note that there is no lower limit, if a client sets an expiry of 0, we will just instantly time out.

§max_session_timeout_ms: u64

Maximum time before a session will be timed out. The client will request a number, this just sets the upper limit on that value. Note that there is no lower limit, if a client sets an expiry of 0 we will instantly time out.

§diagnostics: bool

Enable server diagnostics.

Implementations§

Source§

impl ServerConfig

Source

pub const PKI_DIR: &'static str = "pki"

The default PKI directory

Source

pub fn new<T>( application_name: T, user_tokens: BTreeMap<String, ServerUserToken>, endpoints: BTreeMap<String, ServerEndpoint>, ) -> Self
where T: Into<String>,

Create a new default server config with the given list of user tokens and endpoints.

Source

pub fn decoding_options(&self) -> DecodingOptions

Decoding options given by this config.

Source

pub fn add_endpoint(&mut self, id: &str, endpoint: ServerEndpoint)

Add an endpoint to the server config.

Source

pub fn read_x509_thumbprints(&mut self)

Get x509 thumbprints from registered server user tokens.

Source

pub fn default_endpoint(&self) -> Option<&ServerEndpoint>

Find the default endpoint

Source

pub fn find_endpoint( &self, endpoint_url: &str, base_endpoint_url: &str, security_policy: SecurityPolicy, security_mode: MessageSecurityMode, ) -> Option<&ServerEndpoint>

Find the first endpoint that matches the specified url, security policy and message security mode.

Trait Implementations§

Source§

impl Clone for ServerConfig

Source§

fn clone(&self) -> ServerConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Config for ServerConfig

Source§

fn validate(&self) -> Result<(), Vec<String>>

Validate the config struct, returning a list of validation errors if it fails.
Source§

fn application_name(&self) -> UAString

Get the application name.
Source§

fn application_uri(&self) -> UAString

Get the application URI.
Source§

fn product_uri(&self) -> UAString

Get the configured product URI.
Source§

fn application_type(&self) -> ApplicationType

Get the application type.
Source§

fn discovery_urls(&self) -> Option<Vec<UAString>>

Get the registered discovery URLs for this application.
Source§

fn application_description(&self) -> ApplicationDescription

Create an application description for the configured application.
Source§

fn save(&self, path: &Path) -> Result<(), ConfigError>

Save the configuration object to a file.
Source§

fn load<A>(path: &Path) -> Result<A, ConfigError>
where A: for<'de> Config + for<'de> Deserialize<'de>,

Load the configuration object from the given path.
Source§

impl Debug for ServerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ServerConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ServerConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ServerConfig

Source§

fn eq(&self, other: &ServerConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for ServerConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ServerConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoAnyArc for T
where T: Send + Sync + 'static,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Upcast to Arc<dyn Any>.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T